Skip to content

Commit

Permalink
Fix imports for sanic v21.9.0 and up
Browse files Browse the repository at this point in the history
13g10n authored and miguelgrinberg committed Jan 4, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent e882f59 commit b0157d5
Showing 2 changed files with 13 additions and 8 deletions.
15 changes: 8 additions & 7 deletions examples/server/sanic/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
aiofiles==0.3.0
httptools==0.0.9
python_engineio
sanic==0.3.1
six==1.10.0
ujson==1.35
uvloop==0.8.0
aiofiles==0.8.0
httptools==0.3.0
multidict==5.2.0
sanic==21.12.0
sanic-routing==0.7.2
ujson==5.1.0
uvloop==0.16.0
websockets==10.1
6 changes: 5 additions & 1 deletion src/engineio/async_drivers/sanic.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,11 @@

try: # pragma: no cover
from sanic.response import HTTPResponse
from sanic.websocket import WebSocketProtocol
try:
from sanic.server.protocols.websocket_protocol import WebSocketProtocol
except ImportError:
print('yay')
from sanic.websocket import WebSocketProtocol
except ImportError:
HTTPResponse = None
WebSocketProtocol = None

0 comments on commit b0157d5

Please sign in to comment.