Using aiohttpΒΆ

aiohttp is not installed with gremlinclient by default. Use pip to install it:

$ pip install aiohttp

If you aren’t using tornado, go ahead and uninstall it:

$ pip uninstall tornado

Using the aiohttp client is easy, it provides the exact same objects and API as the Tornado client with one small exception: the close() methods return asyncio.Future that must be yielded from or awaited. For example:

>>> from gremlinclient.aiohttp_client import GraphDatabase
>>> async def get_conn():
...     graph = GraphDatabase("ws://localhost:8182/")
...     conn = await graph.connect()
...     ...
...     await conn.close()  # await close

Or if you are using a Pool:

>>> from gremlinclient.aiohttp_client import Pool
>>> async def use_pool():
...     pool = Pool("ws://localhost:8182/")
...     conn = yield from pool.acquire()
...     ...
...     await pool.release(conn)
...     await pool.close()

For more info, see the aiohttp client docs