Commit 8fe1c881 authored by davebshow's avatar davebshow
Browse files

renamed protocol as subprotocol, add close code in context manager, change...

renamed protocol as subprotocol, add close code in context manager, change error message access from gettr to prop
parent d2e825d8
......@@ -2,6 +2,6 @@ from .connection import *
from .client import *
from .exceptions import *
from .pool import *
from .protocol import *
from .subprotocol import *
__version__ = "0.0.8"
......@@ -10,7 +10,7 @@ from aiogremlin.connection import (GremlinFactory, WebSocketSession,
from aiogremlin.exceptions import RequestError
from aiogremlin.log import logger, INFO
from aiogremlin.pool import WebSocketPool
from aiogremlin.protocol import gremlin_response_parser, GremlinWriter
from aiogremlin.subprotocol import gremlin_response_parser, GremlinWriter
__all__ = ("create_client", "GremlinClient", "GremlinResponse",
"GremlinResponseStream")
......@@ -203,6 +203,7 @@ class GremlinResponseStream:
# self._pool.release(self._conn)
# message = None
# else:
# asyncio.async(self._conn.receive())
# This will be different 3.0.0.M9
try:
yield from self._conn.receive()
......
......@@ -105,7 +105,7 @@ class GremlinClientWebSocketResponse(ClientWebSocketResponse):
if msg.tp == MsgType.close:
yield from ws.close()
elif msg.tp == MsgType.error:
raise msg[1]
raise msg.data
elif msg.tp == MsgType.closed:
pass
......
......@@ -12,6 +12,7 @@ class ConnectionContextManager:
def __exit__(self, exception_type, exception_value, traceback):
try:
self._conn._close_code = 1000
self._conn._closing = True
self._conn._close()
finally:
......
"""Implements a very simple "protocol" for the Gremlin server."""
"""Implements the Gremlin Server subprotocol."""
import asyncio
import collections
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment