summaryrefslogtreecommitdiff
path: root/swiftstory
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2021-12-23 18:24:25 +0100
committerOlivier Gayot <olivier.gayot@sigexec.com>2021-12-23 23:15:21 +0100
commitf028b666acf73f395e01ab22da5100b5202e74ea (patch)
tree73e76dff1853f7d2e9042567641e3895a7f3d52f /swiftstory
parent15b9a844919d51f6f7afeddca453252191a8af7d (diff)
Make sure our use of websockets package is forwards compatible
It seems that between version 8 and 10 of the websockets package, a redesign of the modules hierarchy was performed. In version 8, when importing "websockets", we would end up with a lot of extra things imported in the websockets namespace. For instance: * websockets.exceptions * websockets.server These extra are no longer imported in recent versions. Therefore, we have to be more explicit when importing features from the websockets package. Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'swiftstory')
-rw-r--r--swiftstory/__main__.py5
-rw-r--r--swiftstory/client.py2
2 files changed, 4 insertions, 3 deletions
diff --git a/swiftstory/__main__.py b/swiftstory/__main__.py
index 00c6e39..99176a0 100644
--- a/swiftstory/__main__.py
+++ b/swiftstory/__main__.py
@@ -7,7 +7,8 @@ import asyncio
import contextlib
import json
import logging
-import websockets
+import websockets.server
+import websockets.exceptions
import swiftstory.game_manager
from swiftstory.exception import WrongAction, JoinError
@@ -90,7 +91,7 @@ def main():
logging.basicConfig(level=logging.INFO)
- start_server = websockets.serve(connection_handler, args['listen'], args['port'])
+ start_server = websockets.server.serve(connection_handler, args['listen'], args['port'])
asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()
diff --git a/swiftstory/client.py b/swiftstory/client.py
index 52957c2..527c9c6 100644
--- a/swiftstory/client.py
+++ b/swiftstory/client.py
@@ -2,7 +2,7 @@ import asyncio
import logging
from typing import Optional
-import websockets
+import websockets.exceptions
from swiftstory.game import Game
from swiftstory.exception import WrongAction, UnsupportedLanguage, JoinError