python-engineio 4.12.0__py3-none-any.whl → 4.12.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 +10 -7
- engineio/async_drivers/asgi.py +6 -1
- engineio/base_client.py +12 -1
- engineio/client.py +9 -6
- {python_engineio-4.12.0.dist-info → python_engineio-4.12.2.dist-info}/METADATA +2 -2
- {python_engineio-4.12.0.dist-info → python_engineio-4.12.2.dist-info}/RECORD +9 -9
- {python_engineio-4.12.0.dist-info → python_engineio-4.12.2.dist-info}/WHEEL +1 -1
- {python_engineio-4.12.0.dist-info → python_engineio-4.12.2.dist-info}/licenses/LICENSE +0 -0
- {python_engineio-4.12.0.dist-info → python_engineio-4.12.2.dist-info}/top_level.txt +0 -0
engineio/async_client.py
CHANGED
|
@@ -126,7 +126,6 @@ class AsyncClient(base_client.BaseClient):
|
|
|
126
126
|
if not transports:
|
|
127
127
|
raise ValueError('No valid transports provided')
|
|
128
128
|
self.transports = transports or valid_transports
|
|
129
|
-
self.queue = self.create_queue()
|
|
130
129
|
return await getattr(self, '_connect_' + self.transports[0])(
|
|
131
130
|
url, headers or {}, engineio_path)
|
|
132
131
|
|
|
@@ -199,11 +198,15 @@ class AsyncClient(base_client.BaseClient):
|
|
|
199
198
|
"""
|
|
200
199
|
return await asyncio.sleep(seconds)
|
|
201
200
|
|
|
202
|
-
def create_queue(self):
|
|
201
|
+
def create_queue(self, *args, **kwargs):
|
|
203
202
|
"""Create a queue object."""
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
return asyncio.Queue(*args, **kwargs)
|
|
204
|
+
|
|
205
|
+
def get_queue_empty_exception(self):
|
|
206
|
+
"""Return the queue empty exception raised by queues created by the
|
|
207
|
+
``create_queue()`` method.
|
|
208
|
+
"""
|
|
209
|
+
return asyncio.QueueEmpty
|
|
207
210
|
|
|
208
211
|
def create_event(self):
|
|
209
212
|
"""Create an event object."""
|
|
@@ -624,7 +627,7 @@ class AsyncClient(base_client.BaseClient):
|
|
|
624
627
|
packets = None
|
|
625
628
|
try:
|
|
626
629
|
packets = [await asyncio.wait_for(self.queue.get(), timeout)]
|
|
627
|
-
except (self.
|
|
630
|
+
except (self.queue_empty, asyncio.TimeoutError):
|
|
628
631
|
self.logger.error('packet queue is empty, aborting')
|
|
629
632
|
break
|
|
630
633
|
except asyncio.CancelledError: # pragma: no cover
|
|
@@ -636,7 +639,7 @@ class AsyncClient(base_client.BaseClient):
|
|
|
636
639
|
while True:
|
|
637
640
|
try:
|
|
638
641
|
packets.append(self.queue.get_nowait())
|
|
639
|
-
except self.
|
|
642
|
+
except self.queue_empty:
|
|
640
643
|
break
|
|
641
644
|
if packets[-1] is None:
|
|
642
645
|
packets = packets[:-1]
|
engineio/async_drivers/asgi.py
CHANGED
|
@@ -280,7 +280,12 @@ class WebSocket: # pragma: no cover
|
|
|
280
280
|
event = await self.asgi_receive()
|
|
281
281
|
if event['type'] != 'websocket.receive':
|
|
282
282
|
raise OSError()
|
|
283
|
-
|
|
283
|
+
if event.get('bytes', None) is not None:
|
|
284
|
+
return event['bytes']
|
|
285
|
+
elif event.get('text', None) is not None:
|
|
286
|
+
return event['text']
|
|
287
|
+
else: # pragma: no cover
|
|
288
|
+
raise OSError()
|
|
284
289
|
|
|
285
290
|
|
|
286
291
|
_async = {
|
engineio/base_client.py
CHANGED
|
@@ -61,7 +61,8 @@ class BaseClient:
|
|
|
61
61
|
self.ws = None
|
|
62
62
|
self.read_loop_task = None
|
|
63
63
|
self.write_loop_task = None
|
|
64
|
-
self.queue =
|
|
64
|
+
self.queue = self.create_queue()
|
|
65
|
+
self.queue_empty = self.get_queue_empty_exception()
|
|
65
66
|
self.state = 'disconnected'
|
|
66
67
|
self.ssl_verify = ssl_verify
|
|
67
68
|
self.websocket_extra_options = websocket_extra_options or {}
|
|
@@ -156,3 +157,13 @@ class BaseClient:
|
|
|
156
157
|
if not self.timestamp_requests:
|
|
157
158
|
return ''
|
|
158
159
|
return '&t=' + str(time.time())
|
|
160
|
+
|
|
161
|
+
def create_queue(self, *args, **kwargs): # pragma: no cover
|
|
162
|
+
"""Create a queue object."""
|
|
163
|
+
raise NotImplementedError('must be implemented in a subclass')
|
|
164
|
+
|
|
165
|
+
def get_queue_empty_exception(self): # pragma: no cover
|
|
166
|
+
"""Return the queue empty exception raised by queues created by the
|
|
167
|
+
``create_queue()`` method.
|
|
168
|
+
"""
|
|
169
|
+
raise NotImplementedError('must be implemented in a subclass')
|
engineio/client.py
CHANGED
|
@@ -91,7 +91,6 @@ class Client(base_client.BaseClient):
|
|
|
91
91
|
if not transports:
|
|
92
92
|
raise ValueError('No valid transports provided')
|
|
93
93
|
self.transports = transports or valid_transports
|
|
94
|
-
self.queue = self.create_queue()
|
|
95
94
|
return getattr(self, '_connect_' + self.transports[0])(
|
|
96
95
|
url, headers or {}, engineio_path)
|
|
97
96
|
|
|
@@ -162,9 +161,13 @@ class Client(base_client.BaseClient):
|
|
|
162
161
|
|
|
163
162
|
def create_queue(self, *args, **kwargs):
|
|
164
163
|
"""Create a queue object."""
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
return queue.Queue(*args, **kwargs)
|
|
165
|
+
|
|
166
|
+
def get_queue_empty_exception(self):
|
|
167
|
+
"""Return the queue empty exception raised by queues created by the
|
|
168
|
+
``create_queue()`` method.
|
|
169
|
+
"""
|
|
170
|
+
return queue.Empty
|
|
168
171
|
|
|
169
172
|
def create_event(self, *args, **kwargs):
|
|
170
173
|
"""Create an event object."""
|
|
@@ -566,7 +569,7 @@ class Client(base_client.BaseClient):
|
|
|
566
569
|
packets = None
|
|
567
570
|
try:
|
|
568
571
|
packets = [self.queue.get(timeout=timeout)]
|
|
569
|
-
except self.
|
|
572
|
+
except self.queue_empty:
|
|
570
573
|
self.logger.error('packet queue is empty, aborting')
|
|
571
574
|
break
|
|
572
575
|
if packets == [None]:
|
|
@@ -576,7 +579,7 @@ class Client(base_client.BaseClient):
|
|
|
576
579
|
while True:
|
|
577
580
|
try:
|
|
578
581
|
packets.append(self.queue.get(block=False))
|
|
579
|
-
except self.
|
|
582
|
+
except self.queue_empty:
|
|
580
583
|
break
|
|
581
584
|
if packets[-1] is None:
|
|
582
585
|
packets = packets[:-1]
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-engineio
|
|
3
|
-
Version: 4.12.
|
|
3
|
+
Version: 4.12.2
|
|
4
4
|
Summary: Engine.IO server and client for Python
|
|
5
5
|
Author-email: Miguel Grinberg <miguel.grinberg@gmail.com>
|
|
6
|
+
License: MIT
|
|
6
7
|
Project-URL: Homepage, https://github.com/miguelgrinberg/python-engineio
|
|
7
8
|
Project-URL: Bug Tracker, https://github.com/miguelgrinberg/python-engineio/issues
|
|
8
9
|
Classifier: Environment :: Web Environment
|
|
9
10
|
Classifier: Intended Audience :: Developers
|
|
10
11
|
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
12
12
|
Classifier: Operating System :: OS Independent
|
|
13
13
|
Requires-Python: >=3.6
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
engineio/__init__.py,sha256=0R2PY1EXu3sicP7mkA0_QxEVGRlFlgvsxfhByqREE1A,481
|
|
2
|
-
engineio/async_client.py,sha256=
|
|
2
|
+
engineio/async_client.py,sha256=8XLZ6MRkKasI9wByK2vX6tMfTnojty37aT3NqLRE4X8,29585
|
|
3
3
|
engineio/async_server.py,sha256=8Af_uwf8mKOCJGqVKa3QN0kz7_B2K1cdpSmsvkAoBR4,27412
|
|
4
4
|
engineio/async_socket.py,sha256=nHY0DPPk0FtI9djUnQWtzZ3ce2OD184Tu-Dop7JLg9I,10715
|
|
5
|
-
engineio/base_client.py,sha256=
|
|
5
|
+
engineio/base_client.py,sha256=oOdq-zR7kg8QpvAGti0zBIiFBQGyEELwVMZNtcoJ2ig,5827
|
|
6
6
|
engineio/base_server.py,sha256=S_O5ZWSzdKn4CBC3UjrhZ_Oarw35ge3Gmg5M3CV5C9k,14653
|
|
7
7
|
engineio/base_socket.py,sha256=sQqbNSfGhMQG3xzwar6IXMal28C7Q5TIAQRGp74Wt2o,399
|
|
8
|
-
engineio/client.py,sha256=
|
|
8
|
+
engineio/client.py,sha256=0JKUjfMNg9lkO1t8X3dr-I2164KRV3736XbYw__NQxU,27334
|
|
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
|
|
@@ -17,15 +17,15 @@ 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
19
|
engineio/async_drivers/aiohttp.py,sha256=OBDGhaNXWHxQkwhzZT2vlTAOqWReGS6Sjk9u3BEh_Mc,3754
|
|
20
|
-
engineio/async_drivers/asgi.py,sha256=
|
|
20
|
+
engineio/async_drivers/asgi.py,sha256=WtgJI4ZRbWmS0G6lqtyxA35FWJfs5cDRvXspRzG5xsI,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
26
|
engineio/async_drivers/tornado.py,sha256=mbVHs1mECfzFSNv33uigkpTBtNPT0u49k5zaybewdIo,5893
|
|
27
|
-
python_engineio-4.12.
|
|
28
|
-
python_engineio-4.12.
|
|
29
|
-
python_engineio-4.12.
|
|
30
|
-
python_engineio-4.12.
|
|
31
|
-
python_engineio-4.12.
|
|
27
|
+
python_engineio-4.12.2.dist-info/licenses/LICENSE,sha256=yel9Pbwfu82094CLKCzWRtuIev9PUxP-a76NTDFAWpw,1082
|
|
28
|
+
python_engineio-4.12.2.dist-info/METADATA,sha256=vky1a4DYsWTff93GwPl5obMjX7ufhN17-FvbTMVTH9g,2221
|
|
29
|
+
python_engineio-4.12.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
30
|
+
python_engineio-4.12.2.dist-info/top_level.txt,sha256=u8PmNisCZLwRYcWrNLe9wutQ2tt4zNi8IH362c-HWuA,9
|
|
31
|
+
python_engineio-4.12.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|