Skip to content

Commit 4a15471

Browse files
Try websockets 11.0+ import first, then fall back to <11.0 (#3030)
Co-authored-by: Adam Hopkins <[email protected]>
1 parent f9aec47 commit 4a15471

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sanic/server/websockets/impl.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
from websockets.frames import Frame, Opcode
1717

1818

19-
try: # websockets < 11.0
20-
from websockets.connection import Event, State # type: ignore
21-
from websockets.server import ServerConnection as ServerProtocol
22-
except ImportError: # websockets >= 11.0
19+
try: # websockets >= 11.0
2320
from websockets.protocol import Event, State # type: ignore
2421
from websockets.server import ServerProtocol # type: ignore
22+
except ImportError: # websockets < 11.0
23+
from websockets.connection import Event, State # type: ignore
24+
from websockets.server import ServerConnection as ServerProtocol
2525

2626
from websockets.typing import Data
2727

0 commit comments

Comments
 (0)