From 1b6991e283685dba5703284f5d7a48b44734c868 Mon Sep 17 00:00:00 2001
From: Seth Sims <xzy3@cdc.gov>
Date: Tue, 20 Mar 2018 12:12:35 -0400
Subject: [PATCH] WebSocket.send_bytes is a coroutine as of aiohttp 3.0
 changing transport.write to await the coroutine if necessary.

---
 aiogremlin/driver/aiohttp/transport.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/aiogremlin/driver/aiohttp/transport.py b/aiogremlin/driver/aiohttp/transport.py
index 7801f5b..01e80d7 100644
--- a/aiogremlin/driver/aiohttp/transport.py
+++ b/aiogremlin/driver/aiohttp/transport.py
@@ -1,3 +1,4 @@
+import asyncio
 import aiohttp
 
 from gremlin_python.driver import transport
@@ -18,8 +19,10 @@ class AiohttpTransport(transport.AbstractBaseTransport):
         self._ws = await self._client_session.ws_connect(url)
         self._connected = True
 
-    def write(self, message):
-        self._ws.send_bytes(message)
+    async def write(self, message):
+        coro = self._ws.send_bytes(message)
+        if asyncio.iscoroutine(coro):
+          await coro
 
     async def read(self):
         data = await self._ws.receive()
-- 
GitLab