This package helps you use gremlinpython,
when you can't use asyncio
.
In some settings, e.g. an eventlet
web server with monkey patching, you may run into errors if you try to run code
that relies on Python's asyncio
framework.
(Demonstration here.)
If you want to use gremlinpython
in such a setting, then you need an
alternative to the built-in AiohttpTransport
class.
This package provides the WebsocketClientTransport
class. It relies on the popular
websocket-client package,
which runs without asyncio
.
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
from wsc_grempy_transport.transport import websocket_client_transport_factory
remote = DriverRemoteConnection(
'ws://localhost:8182/gremlin',
transport_factory=websocket_client_transport_factory)
The WebsocketClientTransport
class is very rudimentary. It is essentially
just a wrapper for the websocket.WebSocket
class, and could probably benefit
from some error checking to make it more robust.
Contributions are welcome!