Upgrade websockets dependency. (#2154)
* Upgrade websockets dependency. Fix #2142. * Bumpt sanic-testing version Co-authored-by: Adam Hopkins <adam@amhopkins.com> Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
This commit is contained in:
parent
2c80571a8a
commit
aff6604636
@ -14,9 +14,13 @@ from websockets import ( # type: ignore
|
|||||||
ConnectionClosed,
|
ConnectionClosed,
|
||||||
InvalidHandshake,
|
InvalidHandshake,
|
||||||
WebSocketCommonProtocol,
|
WebSocketCommonProtocol,
|
||||||
handshake,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Despite the "legacy" namespace, the primary maintainer of websockets
|
||||||
|
# committed to maintaining backwards-compatibility until 2026 and will
|
||||||
|
# consider extending it if sanic continues depending on this module.
|
||||||
|
from websockets.legacy import handshake
|
||||||
|
|
||||||
from sanic.exceptions import InvalidUsage
|
from sanic.exceptions import InvalidUsage
|
||||||
from sanic.server import HttpProtocol
|
from sanic.server import HttpProtocol
|
||||||
|
|
||||||
@ -126,7 +130,9 @@ class WebSocketProtocol(HttpProtocol):
|
|||||||
ping_interval=self.websocket_ping_interval,
|
ping_interval=self.websocket_ping_interval,
|
||||||
ping_timeout=self.websocket_ping_timeout,
|
ping_timeout=self.websocket_ping_timeout,
|
||||||
)
|
)
|
||||||
# Following two lines are required for websockets 8.x
|
# we use WebSocketCommonProtocol because we don't want the handshake
|
||||||
|
# logic from WebSocketServerProtocol; however, we must tell it that
|
||||||
|
# we're running on the server side
|
||||||
self.websocket.is_client = False
|
self.websocket.is_client = False
|
||||||
self.websocket.side = "server"
|
self.websocket.side = "server"
|
||||||
self.websocket.subprotocol = subprotocol
|
self.websocket.subprotocol = subprotocol
|
||||||
|
4
setup.py
4
setup.py
@ -88,12 +88,12 @@ requirements = [
|
|||||||
uvloop,
|
uvloop,
|
||||||
ujson,
|
ujson,
|
||||||
"aiofiles>=0.6.0",
|
"aiofiles>=0.6.0",
|
||||||
"websockets>=8.1,<9.0",
|
"websockets>=9.0",
|
||||||
"multidict>=5.0,<6.0",
|
"multidict>=5.0,<6.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
tests_require = [
|
tests_require = [
|
||||||
"sanic-testing",
|
"sanic-testing>=0.6.0",
|
||||||
"pytest==5.2.1",
|
"pytest==5.2.1",
|
||||||
"multidict>=5.0,<6.0",
|
"multidict>=5.0,<6.0",
|
||||||
"gunicorn==20.0.4",
|
"gunicorn==20.0.4",
|
||||||
|
4
tox.ini
4
tox.ini
@ -7,7 +7,7 @@ setenv =
|
|||||||
{py37,py38,py39,pyNightly}-no-ext: SANIC_NO_UJSON=1
|
{py37,py38,py39,pyNightly}-no-ext: SANIC_NO_UJSON=1
|
||||||
{py37,py38,py39,pyNightly}-no-ext: SANIC_NO_UVLOOP=1
|
{py37,py38,py39,pyNightly}-no-ext: SANIC_NO_UVLOOP=1
|
||||||
deps =
|
deps =
|
||||||
sanic-testing
|
sanic-testing>=0.6.0
|
||||||
coverage==5.3
|
coverage==5.3
|
||||||
pytest==5.2.1
|
pytest==5.2.1
|
||||||
pytest-cov
|
pytest-cov
|
||||||
@ -18,7 +18,7 @@ deps =
|
|||||||
beautifulsoup4
|
beautifulsoup4
|
||||||
gunicorn==20.0.4
|
gunicorn==20.0.4
|
||||||
uvicorn
|
uvicorn
|
||||||
websockets>=8.1,<9.0
|
websockets>=9.0
|
||||||
commands =
|
commands =
|
||||||
pytest {posargs:tests --cov sanic}
|
pytest {posargs:tests --cov sanic}
|
||||||
- coverage combine --append
|
- coverage combine --append
|
||||||
|
Loading…
x
Reference in New Issue
Block a user