tornado_client package

Module contents

tornado_client.client module

class gremlinclient.tornado_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, tornado.ioloop.IOLoop.current is used for getting default event loop (optional)
  • future_class (class) – type of Future - asyncio.Future, trollius.Future, or tornado.concurrent.Future
  • connector (func) – a factory for generating tornado.HTTPRequest objects. used with ssl
class gremlinclient.tornado_client.client.Pool(url, graph=None, timeout=None, username='', password='', maxsize=256, loop=None, force_release=False, future_class=None, connector=None)[source]

Bases: gremlinclient.pool.Pool

Pool of gremlinclient.connection.Connection objects.

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
  • graph (gremlinclient.tornado_client.client.GraphDatabase) – The graph instance used to create connections
  • maxsize (int) – Maximum number of connections.
  • loop – event loop
  • future_class (class) – type of Future - asyncio.Future, trollius.Future, or tornado.concurrent.Future
  • connector (func) – a factory for generating tornado.HTTPRequest objects. used with ssl
class gremlinclient.tornado_client.client.Response(conn, future_class, loop=None)[source]

Bases: gremlinclient.response.Response

Wrapper for Tornado websocket client connection.

Parameters:conn (tornado.websocket.WebSocketClientConnection) – The websocket connection
close()[source]

Close underlying client connection.

Returns:type of Future - asyncio.Future, trollius.Future, or tornado.concurrent.Future
closed
Returns:bool True is conn is closed.
conn
Returns:Underlying connection.
receive(callback=None)[source]

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

Returns::py:class:type of Future - asyncio.Future, trollius.Future, or tornado.concurrent.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.tornado_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, tornado.ioloop.IOLoop.current() 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, trollius.Future, or tornado.concurrent.Future
  • session (str) – Session id (optional). Typically a uuid
  • connector (func) – a factory for generating tornado.HTTPRequest objects. used with ssl
Returns:

gremlinclient.connection.Connection object:

gremlinclient.tornado_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, tornado.ioloop.IOLoop.current() 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, trollius.Future, or tornado.concurrent.Future
  • connector (func) – a factory for generating tornado.HTTPRequest objects. used with ssl
Returns:

gremlinclient.connection.Stream object:

tornado_client.remote_connection module