aiohttp_client package

Module contents

aiohttp_client.client module

class gremlinclient.aiohttp_client.client.GraphDatabase(url, timeout=None, username='', password='', loop=None, future_class=None, connector=None)[source]

Bases: gremlinclient.graph.GraphDatabase

This class generates connections to the Gremlin Server.

Parameters:
  • url (str) – url for Gremlin Server.
  • timeout (float) – timeout for establishing connection (optional). Values 0 or None mean no timeout
  • username (str) – Username for SASL auth
  • password (str) – Password for SASL auth
  • loop – If param is None, asyncio.get_event_loop is used for getting default event loop (optional)
  • future_class (class) – type of Future - asyncio.Future
  • connector (aiohttp.TCPConnector) – aiohttp.TCPConnector object. used with ssl
class gremlinclient.aiohttp_client.client.Pool(url, timeout=None, username='', password='', maxsize=256, loop=None, future_class=None, force_release=False, connector=None)[source]

Bases: gremlinclient.pool.Pool

Pool of gremlinclient.connection.Connection objects.

Parameters:
close()[source]

Close pool. :returns: asyncio.Future

release(conn)[source]

Release a connection back to the pool.

Parameters:gremlinclient.connection.Connection – The connection to be released
Returns:asyncio.Future
class gremlinclient.aiohttp_client.client.Response(conn, future_class, loop=None)[source]

Bases: gremlinclient.response.Response

Wrapper for aiohttp websocket client connection.

Parameters:conn (aiohttp.ClientWebSocketResponse) – The websocket connection
close()[source]

Close underlying client connection :returns: asyncio.Future

closed
Returns:bool. True if conn is closed
receive(callback=None)[source]

Read a message off the websocket. :param callback: To be called on message read.

Returns:asyncio.Future
send(msg, binary=True)[source]

Send a message

Parameters:
  • msg – The message to be sent.
  • binary (bool) – Whether or not the message is encoded as bytes.
gremlinclient.aiohttp_client.client.create_connection(url, timeout=None, username='', password='', loop=None, session=None, force_close=False, future_class=None, connector=None)[source]

Get a database connection from the Gremlin Server.

Parameters:
  • url (str) – url for Gremlin Server.
  • timeout (float) – timeout for establishing connection (optional). Values 0 or None mean no timeout
  • username (str) – Username for SASL auth
  • password (str) – Password for SASL auth
  • loop – If param is None, asyncio.get_event_loop() is used for getting default event loop (optional)
  • force_close (bool) – force connection to close after read.
  • future_class (class) – type of Future - asyncio.Future by default
  • session (str) – Session id (optional). Typically a uuid
  • connector (aiohttp.TCPConnector) – aiohttp.TCPConnector object. used with ssl
Returns:

gremlinclient.connection.Connection object:

gremlinclient.aiohttp_client.client.submit(url, gremlin, bindings=None, lang='gremlin-groovy', aliases=None, op='eval', processor='', timeout=None, session=None, loop=None, username='', password='', future_class=None, connector=None)[source]

Submit a script to the Gremlin Server.

Parameters:
  • url (str) – url for Gremlin Server.
  • gremlin (str) – Gremlin script to submit to server.
  • bindings (dict) – A mapping of bindings for Gremlin script.
  • lang (str) – Language of scripts submitted to the server. “gremlin-groovy” by default
  • aliases (dict) – Rebind Graph and TraversalSource objects to different variable names in the current request
  • op (str) – Gremlin Server op argument. “eval” by default.
  • processor (str) – Gremlin Server processor argument. “” by default.
  • timeout (float) – timeout for establishing connection (optional). Values 0 or None mean no timeout
  • session (str) – Session id (optional). Typically a uuid
  • loop – If param is None, asyncio.get_event_loop() is used for getting default event loop (optional)
  • username (str) – Username for SASL auth
  • password (str) – Password for SASL auth
  • future_class (class) – type of Future - asyncio.Future by default
  • connector (aiohttp.TCPConnector) – aiohttp.TCPConnector object. used with ssl
Returns:

gremlinclient.connection.Stream object:

aiohttp_client.remote_connection module