python-engineio 4.13.0__py3-none-any.whl → 4.13.2__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 +3 -2
- engineio/async_drivers/aiohttp.py +3 -1
- engineio/async_drivers/asgi.py +12 -13
- engineio/async_server.py +6 -4
- engineio/async_socket.py +4 -2
- engineio/base_socket.py +4 -1
- engineio/client.py +3 -2
- engineio/server.py +6 -4
- engineio/socket.py +4 -2
- {python_engineio-4.13.0.dist-info → python_engineio-4.13.2.dist-info}/METADATA +3 -2
- {python_engineio-4.13.0.dist-info → python_engineio-4.13.2.dist-info}/RECORD +14 -14
- {python_engineio-4.13.0.dist-info → python_engineio-4.13.2.dist-info}/WHEEL +1 -1
- {python_engineio-4.13.0.dist-info → python_engineio-4.13.2.dist-info}/top_level.txt +0 -0
- {python_engineio-4.13.0.dist-info → python_engineio-4.13.2.dist-info}/licenses/LICENSE +0 -0
engineio/async_client.py
CHANGED
|
@@ -55,10 +55,11 @@ class AsyncClient(base_client.BaseClient):
|
|
|
55
55
|
use. To disable logging set to ``False``. The default is
|
|
56
56
|
``False``. Note that fatal errors are logged even when
|
|
57
57
|
``logger`` is ``False``.
|
|
58
|
-
:param json: An alternative
|
|
58
|
+
:param json: An alternative JSON module to use for encoding and decoding
|
|
59
59
|
packets. Custom json modules must have ``dumps`` and ``loads``
|
|
60
60
|
functions that are compatible with the standard library
|
|
61
|
-
versions.
|
|
61
|
+
versions. This is a process-wide setting, all instantiated
|
|
62
|
+
servers and clients must use the same JSON module.
|
|
62
63
|
:param request_timeout: A timeout in seconds for requests. The default is
|
|
63
64
|
5 seconds.
|
|
64
65
|
:param http_session: an initialized ``aiohttp.ClientSession`` object to be
|
|
@@ -79,11 +79,13 @@ class WebSocket: # pragma: no cover
|
|
|
79
79
|
"""
|
|
80
80
|
def __init__(self, handler, server):
|
|
81
81
|
self.handler = handler
|
|
82
|
+
self.server = server
|
|
82
83
|
self._sock = None
|
|
83
84
|
|
|
84
85
|
async def __call__(self, environ):
|
|
85
86
|
request = environ['aiohttp.request']
|
|
86
|
-
self._sock = WebSocketResponse(
|
|
87
|
+
self._sock = WebSocketResponse(
|
|
88
|
+
max_msg_size=self.server.max_http_buffer_size)
|
|
87
89
|
await self._sock.prepare(request)
|
|
88
90
|
|
|
89
91
|
self.environ = environ
|
engineio/async_drivers/asgi.py
CHANGED
|
@@ -136,10 +136,18 @@ class ASGIApp:
|
|
|
136
136
|
|
|
137
137
|
async def translate_request(scope, receive, send):
|
|
138
138
|
class AwaitablePayload: # pragma: no cover
|
|
139
|
-
def __init__(self,
|
|
140
|
-
self.
|
|
139
|
+
def __init__(self, event):
|
|
140
|
+
self.event = event
|
|
141
|
+
self.payload = None
|
|
141
142
|
|
|
142
143
|
async def read(self, length=None):
|
|
144
|
+
if self.payload is None and event['type'] == 'http.request':
|
|
145
|
+
# read payload from http request
|
|
146
|
+
self.payload = self.event.get('body') or b''
|
|
147
|
+
while self.event.get('more_body'):
|
|
148
|
+
self.event = await receive()
|
|
149
|
+
if self.event['type'] == 'http.request':
|
|
150
|
+
self.payload += self.event.get('body') or b''
|
|
143
151
|
if length is None:
|
|
144
152
|
r = self.payload
|
|
145
153
|
self.payload = b''
|
|
@@ -149,16 +157,7 @@ async def translate_request(scope, receive, send):
|
|
|
149
157
|
return r
|
|
150
158
|
|
|
151
159
|
event = await receive()
|
|
152
|
-
|
|
153
|
-
if event['type'] == 'http.request':
|
|
154
|
-
payload += event.get('body') or b''
|
|
155
|
-
while event.get('more_body'):
|
|
156
|
-
event = await receive()
|
|
157
|
-
if event['type'] == 'http.request':
|
|
158
|
-
payload += event.get('body') or b''
|
|
159
|
-
elif event['type'] == 'websocket.connect':
|
|
160
|
-
pass
|
|
161
|
-
else:
|
|
160
|
+
if event['type'] not in ['http.request', 'websocket.connect']:
|
|
162
161
|
return {}
|
|
163
162
|
|
|
164
163
|
raw_uri = scope['path']
|
|
@@ -171,7 +170,7 @@ async def translate_request(scope, receive, send):
|
|
|
171
170
|
else:
|
|
172
171
|
raw_uri += '?' + query_string
|
|
173
172
|
environ = {
|
|
174
|
-
'wsgi.input': AwaitablePayload(
|
|
173
|
+
'wsgi.input': AwaitablePayload(event),
|
|
175
174
|
'wsgi.errors': sys.stderr,
|
|
176
175
|
'wsgi.version': (1, 0),
|
|
177
176
|
'wsgi.async': True,
|
engineio/async_server.py
CHANGED
|
@@ -64,10 +64,11 @@ class AsyncServer(base_server.BaseServer):
|
|
|
64
64
|
:param logger: To enable logging set to ``True`` or pass a logger object to
|
|
65
65
|
use. To disable logging set to ``False``. Note that fatal
|
|
66
66
|
errors are logged even when ``logger`` is ``False``.
|
|
67
|
-
:param json: An alternative
|
|
68
|
-
packets. Custom
|
|
67
|
+
:param json: An alternative JSON module to use for encoding and decoding
|
|
68
|
+
packets. Custom JSON modules must have ``dumps`` and ``loads``
|
|
69
69
|
functions that are compatible with the standard library
|
|
70
|
-
versions.
|
|
70
|
+
versions. This is a process-wide setting, all instantiated
|
|
71
|
+
servers and clients must use the same JSON module.
|
|
71
72
|
:param async_handlers: If set to ``True``, run message event handlers in
|
|
72
73
|
non-blocking threads. To run handlers synchronously,
|
|
73
74
|
set to ``False``. The default is ``True``.
|
|
@@ -461,7 +462,6 @@ class AsyncServer(base_server.BaseServer):
|
|
|
461
462
|
'maxPayload': self.max_http_buffer_size,
|
|
462
463
|
})
|
|
463
464
|
await s.send(pkt)
|
|
464
|
-
s.schedule_ping()
|
|
465
465
|
|
|
466
466
|
ret = await self._trigger_event('connect', sid, environ,
|
|
467
467
|
run_async=False)
|
|
@@ -470,6 +470,8 @@ class AsyncServer(base_server.BaseServer):
|
|
|
470
470
|
self.logger.warning('Application rejected connection')
|
|
471
471
|
return self._unauthorized(ret or None)
|
|
472
472
|
|
|
473
|
+
s.schedule_ping()
|
|
474
|
+
|
|
473
475
|
if transport == 'websocket':
|
|
474
476
|
ret = await s.handle_get_request(environ)
|
|
475
477
|
if s.closed and sid in self.sockets:
|
engineio/async_socket.py
CHANGED
|
@@ -128,10 +128,12 @@ class AsyncSocket(base_socket.BaseSocket):
|
|
|
128
128
|
await self.queue.join()
|
|
129
129
|
|
|
130
130
|
def schedule_ping(self):
|
|
131
|
-
|
|
131
|
+
# only schedule a new ping if the previous ping wait cycle completed
|
|
132
|
+
if self.last_ping:
|
|
133
|
+
self.last_ping = None
|
|
134
|
+
self.server.start_background_task(self._send_ping)
|
|
132
135
|
|
|
133
136
|
async def _send_ping(self):
|
|
134
|
-
self.last_ping = None
|
|
135
137
|
await asyncio.sleep(self.server.ping_interval)
|
|
136
138
|
if not self.closing and not self.closed:
|
|
137
139
|
self.last_ping = time.time()
|
engineio/base_socket.py
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import time
|
|
2
|
+
|
|
3
|
+
|
|
1
4
|
class BaseSocket:
|
|
2
5
|
upgrade_protocols = ['websocket']
|
|
3
6
|
|
|
@@ -5,7 +8,7 @@ class BaseSocket:
|
|
|
5
8
|
self.server = server
|
|
6
9
|
self.sid = sid
|
|
7
10
|
self.queue = self.server.create_queue()
|
|
8
|
-
self.last_ping =
|
|
11
|
+
self.last_ping = time.time()
|
|
9
12
|
self.connected = False
|
|
10
13
|
self.upgrading = False
|
|
11
14
|
self.upgraded = False
|
engineio/client.py
CHANGED
|
@@ -34,10 +34,11 @@ class Client(base_client.BaseClient):
|
|
|
34
34
|
use. To disable logging set to ``False``. The default is
|
|
35
35
|
``False``. Note that fatal errors are logged even when
|
|
36
36
|
``logger`` is ``False``.
|
|
37
|
-
:param json: An alternative
|
|
37
|
+
:param json: An alternative JSON module to use for encoding and decoding
|
|
38
38
|
packets. Custom json modules must have ``dumps`` and ``loads``
|
|
39
39
|
functions that are compatible with the standard library
|
|
40
|
-
versions.
|
|
40
|
+
versions. This is a process-wide setting, all instantiated
|
|
41
|
+
servers and clients must use the same JSON module.
|
|
41
42
|
:param request_timeout: A timeout in seconds for requests. The default is
|
|
42
43
|
5 seconds.
|
|
43
44
|
:param http_session: an initialized ``requests.Session`` object to be used
|
engineio/server.py
CHANGED
|
@@ -63,10 +63,11 @@ class Server(base_server.BaseServer):
|
|
|
63
63
|
use. To disable logging set to ``False``. The default is
|
|
64
64
|
``False``. Note that fatal errors are logged even when
|
|
65
65
|
``logger`` is ``False``.
|
|
66
|
-
:param json: An alternative
|
|
67
|
-
packets. Custom
|
|
66
|
+
:param json: An alternative JSON module to use for encoding and decoding
|
|
67
|
+
packets. Custom JSON modules must have ``dumps`` and ``loads``
|
|
68
68
|
functions that are compatible with the standard library
|
|
69
|
-
versions.
|
|
69
|
+
versions. This is a process-wide setting, all instantiated
|
|
70
|
+
servers and clients must use the same JSON module.
|
|
70
71
|
:param async_handlers: If set to ``True``, run message event handlers in
|
|
71
72
|
non-blocking threads. To run handlers synchronously,
|
|
72
73
|
set to ``False``. The default is ``True``.
|
|
@@ -400,7 +401,6 @@ class Server(base_server.BaseServer):
|
|
|
400
401
|
'maxPayload': self.max_http_buffer_size,
|
|
401
402
|
})
|
|
402
403
|
s.send(pkt)
|
|
403
|
-
s.schedule_ping()
|
|
404
404
|
|
|
405
405
|
# NOTE: some sections below are marked as "no cover" to workaround
|
|
406
406
|
# what seems to be a bug in the coverage package. All the lines below
|
|
@@ -412,6 +412,8 @@ class Server(base_server.BaseServer):
|
|
|
412
412
|
self.logger.warning('Application rejected connection')
|
|
413
413
|
return self._unauthorized(ret or None)
|
|
414
414
|
|
|
415
|
+
s.schedule_ping()
|
|
416
|
+
|
|
415
417
|
if transport == 'websocket': # pragma: no cover
|
|
416
418
|
ret = s.handle_get_request(environ, start_response)
|
|
417
419
|
if s.closed and sid in self.sockets:
|
engineio/socket.py
CHANGED
|
@@ -130,10 +130,12 @@ class Socket(base_socket.BaseSocket):
|
|
|
130
130
|
self.queue.join()
|
|
131
131
|
|
|
132
132
|
def schedule_ping(self):
|
|
133
|
-
|
|
133
|
+
# only schedule a new ping if the previous ping wait cycle completed
|
|
134
|
+
if self.last_ping:
|
|
135
|
+
self.last_ping = None
|
|
136
|
+
self.server.start_background_task(self._send_ping)
|
|
134
137
|
|
|
135
138
|
def _send_ping(self):
|
|
136
|
-
self.last_ping = None
|
|
137
139
|
self.server.sleep(self.server.ping_interval)
|
|
138
140
|
if not self.closing and not self.closed:
|
|
139
141
|
self.last_ping = time.time()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-engineio
|
|
3
|
-
Version: 4.13.
|
|
3
|
+
Version: 4.13.2
|
|
4
4
|
Summary: Engine.IO server and client for Python
|
|
5
5
|
Author-email: Miguel Grinberg <miguel.grinberg@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -18,11 +18,12 @@ Provides-Extra: client
|
|
|
18
18
|
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
|
-
Requires-Dist: aiohttp>=3.
|
|
21
|
+
Requires-Dist: aiohttp>=3.11; extra == "asyncio-client"
|
|
22
22
|
Provides-Extra: dev
|
|
23
23
|
Requires-Dist: tox; extra == "dev"
|
|
24
24
|
Provides-Extra: docs
|
|
25
25
|
Requires-Dist: sphinx; extra == "docs"
|
|
26
|
+
Requires-Dist: furo; extra == "docs"
|
|
26
27
|
Dynamic: license-file
|
|
27
28
|
|
|
28
29
|
python-engineio
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
engineio/__init__.py,sha256=0R2PY1EXu3sicP7mkA0_QxEVGRlFlgvsxfhByqREE1A,481
|
|
2
|
-
engineio/async_client.py,sha256=
|
|
3
|
-
engineio/async_server.py,sha256=
|
|
4
|
-
engineio/async_socket.py,sha256=
|
|
2
|
+
engineio/async_client.py,sha256=EQzirWwJ_gUinklogHvHN1vz5Ux0zUt-RhGkCureJbE,29976
|
|
3
|
+
engineio/async_server.py,sha256=7oQClUwwSiPlFFUSEBeE6VuOYnbK2z8FCmRqeWoiiVE,27558
|
|
4
|
+
engineio/async_socket.py,sha256=2agIDyicauuHuDHf_2WtUWreq1BP5iu5FQu9tSHWdtY,10827
|
|
5
5
|
engineio/base_client.py,sha256=oOdq-zR7kg8QpvAGti0zBIiFBQGyEELwVMZNtcoJ2ig,5827
|
|
6
6
|
engineio/base_server.py,sha256=tTCqc65Vzf-0Be1uunt1FuGxPOvcpOUCxnT5V2mZCWo,14763
|
|
7
|
-
engineio/base_socket.py,sha256=
|
|
8
|
-
engineio/client.py,sha256
|
|
7
|
+
engineio/base_socket.py,sha256=PWiJC1msNo-0ctlP3JAwWsngKvnYM-ZjS6B6zzfu-eM,420
|
|
8
|
+
engineio/client.py,sha256=-9f8kLYOw86QXrFx5PoyI56uHZ1cUKbhVYolTEj-2t8,27784
|
|
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
|
|
12
12
|
engineio/packet.py,sha256=YO3gmeKUoKyIsUq2e1z7Zifr5PGeS3gnaCeqR7wj5hQ,3198
|
|
13
13
|
engineio/payload.py,sha256=GIWu0Vnay4WNZlDxHqVgP34tKTBXX58OArJ-mO5zD3E,1539
|
|
14
|
-
engineio/server.py,sha256=
|
|
15
|
-
engineio/socket.py,sha256=
|
|
14
|
+
engineio/server.py,sha256=P6Pa53MRJVoXL_n5tEONuIQoBtOvsdFR5GylKgu5oUE,23088
|
|
15
|
+
engineio/socket.py,sha256=WUwGT9MByp04KjHiEnDaESosNsxYxp6AG1tB3pei9eQ,10454
|
|
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=SOU9KOoru_OzxLioSKCYNIZQZLoyf-oxw6-bXc6-_L8,3697
|
|
20
|
+
engineio/async_drivers/asgi.py,sha256=9qAPXs4wO4TxTyF-Se-nhilqzufj9on63MWM66D4j0g,11535
|
|
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
26
|
engineio/async_drivers/tornado.py,sha256=v9uuGk8_HS6DjhoEKXfjHpki1FnydN4wi7eyBMsUTJA,5908
|
|
27
|
-
python_engineio-4.13.
|
|
28
|
-
python_engineio-4.13.
|
|
29
|
-
python_engineio-4.13.
|
|
30
|
-
python_engineio-4.13.
|
|
31
|
-
python_engineio-4.13.
|
|
27
|
+
python_engineio-4.13.2.dist-info/licenses/LICENSE,sha256=yel9Pbwfu82094CLKCzWRtuIev9PUxP-a76NTDFAWpw,1082
|
|
28
|
+
python_engineio-4.13.2.dist-info/METADATA,sha256=XanaByNEwDBrXOcmqz5fT8CJ2S4qW3voMSpa4Mrchd0,2314
|
|
29
|
+
python_engineio-4.13.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
30
|
+
python_engineio-4.13.2.dist-info/top_level.txt,sha256=u8PmNisCZLwRYcWrNLe9wutQ2tt4zNi8IH362c-HWuA,9
|
|
31
|
+
python_engineio-4.13.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|