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]
auto_run(graph_name, cypher, parameters=None, readonly=False)[source]

Run a single query within an auto-commit transaction. This method may invoke network activity

Parameters:
  • graph_name
  • cypher
  • parameters
  • readonly
Returns:

begin(graph_name, readonly=False)[source]

Begin a transaction. This method may invoke network activity.

Parameters:
  • graph_name
  • readonly
Returns:

new Transaction object

Raises:

TransactionError – 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:
classmethod open(profile, user_agent=None, on_bind=None, on_unbind=None, on_release=None, on_broken=None)[source]

Open an HTTP connection to a server.

Parameters:
  • profileConnectionProfile detailing how and where to connect
  • user_agent
  • on_bind
  • on_unbind
  • on_release
  • on_broken
Returns:

HTTP connection object

Raises:

ConnectionUnavailable if a connection cannot be opened

rollback(tx)[source]

Rollback a transaction. This method will always invoke network activity.

Parameters:

tx – the transaction to rollback

Returns:

bookmark

Raises:
supports_multi()[source]

Detect whether or not this connection supports multi-database.

sync(result)[source]

Perform network synchronisation required to make available a given result.

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:BrokenTransactionError 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:BrokenTransactionError 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:BrokenTransactionError 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
summary()[source]

Gather and return summary information as relates to the current progress of query execution and result retrieval. This method does not carry out any network activity.

Returns:summary information
take_record()[source]

Return the next record from the buffer if one is available, None otherwise. This method does not carry out any network activity.

Returns:record or None