py2neo.client.http
– Low-level HTTP client for Neo4j¶
-
class
py2neo.client.http.
HTTP
(profile, user_agent, on_bind=None, on_unbind=None, on_release=None)[source]¶ -
begin
(graph_name, readonly=False)[source]¶ Begin a transaction. This method may invoke network activity.
Parameters: - graph_name –
- readonly –
Returns: new
Transaction
objectRaises: Failure – if a new transaction cannot be created
-
broken
¶ True if the connection has been broken by the server or network.
-
closed
¶ True if the connection has been closed by the client.
-
commit
(tx)[source]¶ Commit a transaction. This method will always invoke network activity.
Parameters: tx – the transaction to commit
Returns: bookmark
Raises: - ValueError – if the supplied
Transaction
object is not valid for committing - ConnectionBroken – if the transaction cannot be committed
- ValueError – if the supplied
-
classmethod
open
(profile=None, user_agent=None, on_bind=None, on_unbind=None, on_release=None, on_broken=None)[source]¶ Open an HTTP connection to a server.
Parameters: - profile –
ConnectionProfile
detailing how and where to connect - user_agent –
- on_bind –
- on_unbind –
- on_release –
- on_broken –
Returns: HTTP
connection objectRaises: ConnectionUnavailable
if a connection cannot be opened- profile –
-
rollback
(tx)[source]¶ Rollback a transaction. This method will always invoke network activity.
Parameters: tx – the transaction to rollback
Returns: bookmark
Raises: - ValueError – if the supplied
Transaction
object is not valid for rolling back - ConnectionBroken – if the transaction cannot be rolled back
- ValueError – if the supplied
-
-
class
py2neo.client.http.
HTTPResult
(graph_name, result, profile=None)[source]¶ -
buffer
()[source]¶ Fetch the remainder of the result into memory. This method may carry out network activity.
Raises: ConnectionBroken
if the transaction is broken by an unexpected network event.
-
fetch
()[source]¶ Fetch and return the next record in this result, or
None
if at the end of the result. This method may carry out network activity.Returns: the next available record, or None
Raises: ConnectionBroken
if the transaction is broken by an unexpected network event.
-
fields
()[source]¶ Return the list of field names for records in this result. This method may carry out network activity.
Returns: list of field names Raises: ConnectionBroken
if the transaction is broken by an unexpected network event.
-
has_records
()[source]¶ Return
True
if this result contains buffered records,False
otherwise. This method does not carry out any network activity.Returns: boolean indicator
-
peek_records
(limit)[source]¶ Return up to limit records from the buffer if available. This method does not carry out any network activity.
Returns: list of records
-