gremlinclient¶
gremlinclient
is an asynchronous multi-client Python driver for the
TinkerPop 3 Gremlin Server. By default, it uses the Tornado websocket client
implementation to communicate with the server, but it also supports aiohttp for a
pure Asyncio implementation–support for Pulsar and requests-futures coming soon.
Releases¶
The latest release of gremlinclient
is 0.2.6.
Requirements¶
gremlinclient
with Tornado requires Python 2.7+. That said, there are a variety of
client/library combinations that work with different versions of Python.
Tornado
- Python 2.7+
Tornado w/Asyncio
- Python 3.3+
Tornado w/Trollius
- Python 2.7
- Python 3.4+
Getting Started¶
Submit a script to the Gremlin Server with Python 2.7 or 3.3+ using Tornado:
>>> from tornado import gen
>>> from tornado.ioloop import IOLoop
>>> from gremlinclient.tornado_client import submit
>>> loop = IOLoop.current()
>>> @gen.coroutine
... def go():
... resp = yield submit("ws://localhost:8182/", "1 + 1")
... while True:
... msg = yield resp.read()
... if msg is None:
... break
... print(msg)
>>> loop.run_sync(go)
Message(status_code=200, data=[2], message=u'', metadata={})
Contents: