python-engineio 4.12.3__py3-none-any.whl → 4.13.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- engineio/async_client.py +8 -6
- engineio/async_drivers/aiohttp.py +9 -16
- engineio/async_drivers/asgi.py +3 -3
- engineio/async_drivers/tornado.py +2 -1
- engineio/async_server.py +4 -3
- engineio/client.py +6 -3
- {python_engineio-4.12.3.dist-info → python_engineio-4.13.0.dist-info}/METADATA +4 -2
- {python_engineio-4.12.3.dist-info → python_engineio-4.13.0.dist-info}/RECORD +11 -11
- {python_engineio-4.12.3.dist-info → python_engineio-4.13.0.dist-info}/WHEEL +0 -0
- {python_engineio-4.12.3.dist-info → python_engineio-4.13.0.dist-info}/licenses/LICENSE +0 -0
- {python_engineio-4.12.3.dist-info → python_engineio-4.13.0.dist-info}/top_level.txt +0 -0
engineio/async_client.py
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
+
from http.cookies import SimpleCookie
|
|
3
|
+
import inspect
|
|
2
4
|
import signal
|
|
3
5
|
import ssl
|
|
4
6
|
import threading
|
|
@@ -319,16 +321,16 @@ class AsyncClient(base_client.BaseClient):
|
|
|
319
321
|
|
|
320
322
|
# extract any new cookies passed in a header so that they can also be
|
|
321
323
|
# sent the the WebSocket route
|
|
322
|
-
cookies = {}
|
|
323
324
|
for header, value in headers.items():
|
|
324
325
|
if header.lower() == 'cookie':
|
|
325
|
-
|
|
326
|
-
|
|
326
|
+
ck = SimpleCookie(headers[header])
|
|
327
|
+
self.http.cookie_jar.update_cookies(
|
|
328
|
+
{k: m.value for k, m in ck.items()})
|
|
327
329
|
del headers[header]
|
|
328
330
|
break
|
|
329
|
-
self.http.cookie_jar.update_cookies(cookies)
|
|
330
331
|
|
|
331
|
-
extra_options = {
|
|
332
|
+
extra_options = {
|
|
333
|
+
'timeout': aiohttp.ClientWSTimeout(ws_close=self.request_timeout)}
|
|
332
334
|
if not self.ssl_verify:
|
|
333
335
|
ssl_context = ssl.create_default_context()
|
|
334
336
|
ssl_context.check_hostname = False
|
|
@@ -468,7 +470,7 @@ class AsyncClient(base_client.BaseClient):
|
|
|
468
470
|
run_async = kwargs.pop('run_async', False)
|
|
469
471
|
ret = None
|
|
470
472
|
if event in self.handlers:
|
|
471
|
-
if
|
|
473
|
+
if inspect.iscoroutinefunction(self.handlers[event]) is True:
|
|
472
474
|
if run_async:
|
|
473
475
|
task = self.start_background_task(self.handlers[event],
|
|
474
476
|
*args)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import inspect
|
|
2
2
|
import sys
|
|
3
|
-
from urllib.parse import urlsplit
|
|
4
3
|
|
|
5
4
|
from aiohttp.web import Response, WebSocketResponse
|
|
6
5
|
|
|
@@ -22,12 +21,8 @@ def translate_request(request):
|
|
|
22
21
|
"""This function takes the arguments passed to the request handler and
|
|
23
22
|
uses them to generate a WSGI compatible environ dictionary.
|
|
24
23
|
"""
|
|
25
|
-
message = request._message
|
|
26
|
-
payload = request._payload
|
|
27
|
-
|
|
28
|
-
uri_parts = urlsplit(message.path)
|
|
29
24
|
environ = {
|
|
30
|
-
'wsgi.input':
|
|
25
|
+
'wsgi.input': request.content,
|
|
31
26
|
'wsgi.errors': sys.stderr,
|
|
32
27
|
'wsgi.version': (1, 0),
|
|
33
28
|
'wsgi.async': True,
|
|
@@ -35,10 +30,10 @@ def translate_request(request):
|
|
|
35
30
|
'wsgi.multiprocess': False,
|
|
36
31
|
'wsgi.run_once': False,
|
|
37
32
|
'SERVER_SOFTWARE': 'aiohttp',
|
|
38
|
-
'REQUEST_METHOD':
|
|
39
|
-
'QUERY_STRING':
|
|
40
|
-
'RAW_URI':
|
|
41
|
-
'SERVER_PROTOCOL': 'HTTP
|
|
33
|
+
'REQUEST_METHOD': request.method,
|
|
34
|
+
'QUERY_STRING': request.query_string or '',
|
|
35
|
+
'RAW_URI': request.path_qs,
|
|
36
|
+
'SERVER_PROTOCOL': f'HTTP/{request.version[0]}.{request.version[1]}',
|
|
42
37
|
'REMOTE_ADDR': '127.0.0.1',
|
|
43
38
|
'REMOTE_PORT': '0',
|
|
44
39
|
'SERVER_NAME': 'aiohttp',
|
|
@@ -46,7 +41,7 @@ def translate_request(request):
|
|
|
46
41
|
'aiohttp.request': request
|
|
47
42
|
}
|
|
48
43
|
|
|
49
|
-
for hdr_name, hdr_value in
|
|
44
|
+
for hdr_name, hdr_value in request.headers.items():
|
|
50
45
|
hdr_name = hdr_name.upper()
|
|
51
46
|
if hdr_name == 'CONTENT-TYPE':
|
|
52
47
|
environ['CONTENT_TYPE'] = hdr_value
|
|
@@ -63,9 +58,7 @@ def translate_request(request):
|
|
|
63
58
|
|
|
64
59
|
environ['wsgi.url_scheme'] = environ.get('HTTP_X_FORWARDED_PROTO', 'http')
|
|
65
60
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
environ['PATH_INFO'] = path_info
|
|
61
|
+
environ['PATH_INFO'] = request.path
|
|
69
62
|
environ['SCRIPT_NAME'] = ''
|
|
70
63
|
|
|
71
64
|
return environ
|
|
@@ -105,7 +98,7 @@ class WebSocket: # pragma: no cover
|
|
|
105
98
|
f = self._sock.send_bytes
|
|
106
99
|
else:
|
|
107
100
|
f = self._sock.send_str
|
|
108
|
-
if
|
|
101
|
+
if inspect.iscoroutinefunction(f):
|
|
109
102
|
await f(message)
|
|
110
103
|
else:
|
|
111
104
|
f(message)
|
engineio/async_drivers/asgi.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import inspect
|
|
1
2
|
import os
|
|
2
3
|
import sys
|
|
3
|
-
import asyncio
|
|
4
4
|
|
|
5
5
|
from engineio.static_files import get_static_file
|
|
6
6
|
|
|
@@ -102,7 +102,7 @@ class ASGIApp:
|
|
|
102
102
|
if self.on_startup:
|
|
103
103
|
try:
|
|
104
104
|
await self.on_startup() \
|
|
105
|
-
if
|
|
105
|
+
if inspect.iscoroutinefunction(self.on_startup) \
|
|
106
106
|
else self.on_startup()
|
|
107
107
|
except:
|
|
108
108
|
await send({'type': 'lifespan.startup.failed'})
|
|
@@ -112,7 +112,7 @@ class ASGIApp:
|
|
|
112
112
|
if self.on_shutdown:
|
|
113
113
|
try:
|
|
114
114
|
await self.on_shutdown() \
|
|
115
|
-
if
|
|
115
|
+
if inspect.iscoroutinefunction(self.on_shutdown) \
|
|
116
116
|
else self.on_shutdown()
|
|
117
117
|
except:
|
|
118
118
|
await send({'type': 'lifespan.shutdown.failed'})
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
+
import inspect
|
|
2
3
|
import sys
|
|
3
4
|
from urllib.parse import urlsplit
|
|
4
5
|
from .. import exceptions
|
|
@@ -24,7 +25,7 @@ def get_tornado_handler(engineio_server):
|
|
|
24
25
|
async def get(self, *args, **kwargs):
|
|
25
26
|
if self.request.headers.get('Upgrade', '').lower() == 'websocket':
|
|
26
27
|
ret = super().get(*args, **kwargs)
|
|
27
|
-
if
|
|
28
|
+
if inspect.iscoroutine(ret):
|
|
28
29
|
await ret
|
|
29
30
|
else:
|
|
30
31
|
await engineio_server.handle_request(self)
|
engineio/async_server.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
+
import inspect
|
|
2
3
|
import urllib
|
|
3
4
|
|
|
4
5
|
from . import base_server
|
|
@@ -212,7 +213,7 @@ class AsyncServer(base_server.BaseServer):
|
|
|
212
213
|
Note: this method is a coroutine.
|
|
213
214
|
"""
|
|
214
215
|
translate_request = self._async['translate_request']
|
|
215
|
-
if
|
|
216
|
+
if inspect.iscoroutinefunction(translate_request):
|
|
216
217
|
environ = await translate_request(*args, **kwargs)
|
|
217
218
|
else:
|
|
218
219
|
environ = translate_request(*args, **kwargs)
|
|
@@ -427,7 +428,7 @@ class AsyncServer(base_server.BaseServer):
|
|
|
427
428
|
async def _make_response(self, response_dict, environ):
|
|
428
429
|
cors_headers = self._cors_headers(environ)
|
|
429
430
|
make_response = self._async['make_response']
|
|
430
|
-
if
|
|
431
|
+
if inspect.iscoroutinefunction(make_response):
|
|
431
432
|
response = await make_response(
|
|
432
433
|
response_dict['status'],
|
|
433
434
|
response_dict['headers'] + cors_headers,
|
|
@@ -502,7 +503,7 @@ class AsyncServer(base_server.BaseServer):
|
|
|
502
503
|
run_async = kwargs.pop('run_async', False)
|
|
503
504
|
ret = None
|
|
504
505
|
if event in self.handlers:
|
|
505
|
-
if
|
|
506
|
+
if inspect.iscoroutinefunction(self.handlers[event]):
|
|
506
507
|
async def run_async_handler():
|
|
507
508
|
try:
|
|
508
509
|
try:
|
engineio/client.py
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
from base64 import b64encode
|
|
2
|
-
from
|
|
2
|
+
from http.cookies import SimpleCookie
|
|
3
3
|
import logging
|
|
4
4
|
import queue
|
|
5
5
|
import ssl
|
|
6
6
|
import threading
|
|
7
7
|
import time
|
|
8
8
|
import urllib
|
|
9
|
+
from engineio.json import JSONDecodeError
|
|
9
10
|
|
|
10
11
|
try:
|
|
11
12
|
import requests
|
|
@@ -268,8 +269,10 @@ class Client(base_client.BaseClient):
|
|
|
268
269
|
extra_options = {}
|
|
269
270
|
if self.http:
|
|
270
271
|
# cookies
|
|
271
|
-
|
|
272
|
-
|
|
272
|
+
ck = SimpleCookie()
|
|
273
|
+
for cookie in self.http.cookies:
|
|
274
|
+
ck[cookie.name] = cookie.value
|
|
275
|
+
cookies = ck.output(header='', sep=';').strip()
|
|
273
276
|
for header, value in headers.items():
|
|
274
277
|
if header.lower() == 'cookie':
|
|
275
278
|
if cookies:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-engineio
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.13.0
|
|
4
4
|
Summary: Engine.IO server and client for Python
|
|
5
5
|
Author-email: Miguel Grinberg <miguel.grinberg@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -10,7 +10,7 @@ Classifier: Environment :: Web Environment
|
|
|
10
10
|
Classifier: Intended Audience :: Developers
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Classifier: Operating System :: OS Independent
|
|
13
|
-
Requires-Python: >=3.
|
|
13
|
+
Requires-Python: >=3.8
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
15
|
License-File: LICENSE
|
|
16
16
|
Requires-Dist: simple-websocket>=0.10.0
|
|
@@ -19,6 +19,8 @@ Requires-Dist: requests>=2.21.0; extra == "client"
|
|
|
19
19
|
Requires-Dist: websocket-client>=0.54.0; extra == "client"
|
|
20
20
|
Provides-Extra: asyncio-client
|
|
21
21
|
Requires-Dist: aiohttp>=3.4; extra == "asyncio-client"
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: tox; extra == "dev"
|
|
22
24
|
Provides-Extra: docs
|
|
23
25
|
Requires-Dist: sphinx; extra == "docs"
|
|
24
26
|
Dynamic: license-file
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
engineio/__init__.py,sha256=0R2PY1EXu3sicP7mkA0_QxEVGRlFlgvsxfhByqREE1A,481
|
|
2
|
-
engineio/async_client.py,sha256=
|
|
3
|
-
engineio/async_server.py,sha256=
|
|
2
|
+
engineio/async_client.py,sha256=9BrVZioKkwxch4rnpinhqg7Og0rQtr8rSptN0eRw_3U,29859
|
|
3
|
+
engineio/async_server.py,sha256=V8B3LwmNxRdJNfkrFxq5XnXvtTqbJ8cd3DWkes38rHo,27440
|
|
4
4
|
engineio/async_socket.py,sha256=nHY0DPPk0FtI9djUnQWtzZ3ce2OD184Tu-Dop7JLg9I,10715
|
|
5
5
|
engineio/base_client.py,sha256=oOdq-zR7kg8QpvAGti0zBIiFBQGyEELwVMZNtcoJ2ig,5827
|
|
6
6
|
engineio/base_server.py,sha256=tTCqc65Vzf-0Be1uunt1FuGxPOvcpOUCxnT5V2mZCWo,14763
|
|
7
7
|
engineio/base_socket.py,sha256=sQqbNSfGhMQG3xzwar6IXMal28C7Q5TIAQRGp74Wt2o,399
|
|
8
|
-
engineio/client.py,sha256=
|
|
8
|
+
engineio/client.py,sha256=5zp5dJO11AqCoAzhjRPQ_2o-sEEi-Ll61zEBsKpUqgs,27667
|
|
9
9
|
engineio/exceptions.py,sha256=FyuMb5qhX9CUYP3fEoe1m-faU96ApdQTSbblaaoo8LA,292
|
|
10
10
|
engineio/json.py,sha256=SG5FTojqd1ix6u0dKXJsZVqqdYioZLO4S2GPL7BKl3U,405
|
|
11
11
|
engineio/middleware.py,sha256=5NKBXz-ftuFErUB_V9IDvRHaSOsjhtW-NnuJtquB1nc,3750
|
|
@@ -16,16 +16,16 @@ engineio/socket.py,sha256=Oaw1E7ZDyOCaS7KV151g1u9rqOf1JJHh5gttEU0cSeA,10342
|
|
|
16
16
|
engineio/static_files.py,sha256=pwez9LQFaSQXMbtI0vLyD6UDiokQ4rNfmRYgVLKOthc,2064
|
|
17
17
|
engineio/async_drivers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
18
|
engineio/async_drivers/_websocket_wsgi.py,sha256=LuOEfKhbAw8SplB5PMpYKIUqfCPEadQEpqeiq_leOIA,949
|
|
19
|
-
engineio/async_drivers/aiohttp.py,sha256=
|
|
20
|
-
engineio/async_drivers/asgi.py,sha256=
|
|
19
|
+
engineio/async_drivers/aiohttp.py,sha256=fgio4z82i93vTojINDLSBiYCXNcAHTSqcqyFa4yqyHs,3624
|
|
20
|
+
engineio/async_drivers/asgi.py,sha256=VxkQg3r-vD7W3X4v2QdB_C5bNS55FJYT2SNBRNaHgds,11383
|
|
21
21
|
engineio/async_drivers/eventlet.py,sha256=n1y4OjPdj4J2GIep5N56O29oa5NQgFJVcTBjyO1C-Gs,1735
|
|
22
22
|
engineio/async_drivers/gevent.py,sha256=hnJHeWdDQE2jfoLCP5DnwVPzsQlcTLJUMA5EVf1UL-k,2962
|
|
23
23
|
engineio/async_drivers/gevent_uwsgi.py,sha256=m6ay5dov9FDQl0fbeiKeE-Orh5LiF6zLlYQ64Oa3T5g,5954
|
|
24
24
|
engineio/async_drivers/sanic.py,sha256=GYX8YWR1GbRm-GkMTAQkfkWbY12MOT1IV2DzH0Xx8Ns,4495
|
|
25
25
|
engineio/async_drivers/threading.py,sha256=ywmG59d4H6OHZjKarBN97-9BHEsRxFEz9YN-E9QAu_I,463
|
|
26
|
-
engineio/async_drivers/tornado.py,sha256=
|
|
27
|
-
python_engineio-4.
|
|
28
|
-
python_engineio-4.
|
|
29
|
-
python_engineio-4.
|
|
30
|
-
python_engineio-4.
|
|
31
|
-
python_engineio-4.
|
|
26
|
+
engineio/async_drivers/tornado.py,sha256=v9uuGk8_HS6DjhoEKXfjHpki1FnydN4wi7eyBMsUTJA,5908
|
|
27
|
+
python_engineio-4.13.0.dist-info/licenses/LICENSE,sha256=yel9Pbwfu82094CLKCzWRtuIev9PUxP-a76NTDFAWpw,1082
|
|
28
|
+
python_engineio-4.13.0.dist-info/METADATA,sha256=vVGwJh5HVXm1r3C6ScLjyc-eigmqbNdVLFM-lYuL45g,2276
|
|
29
|
+
python_engineio-4.13.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
30
|
+
python_engineio-4.13.0.dist-info/top_level.txt,sha256=u8PmNisCZLwRYcWrNLe9wutQ2tt4zNi8IH362c-HWuA,9
|
|
31
|
+
python_engineio-4.13.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|