python-engineio 4.13.4__py3-none-any.whl → 4.14.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 CHANGED
@@ -284,7 +284,13 @@ class AsyncClient(base_client.BaseClient):
284
284
 
285
285
  self.state = 'connected'
286
286
  base_client.connected_clients.append(self)
287
- await self._trigger_event('connect', run_async=False)
287
+ try:
288
+ await self._trigger_event('connect', run_async=False)
289
+ except Exception as exc:
290
+ base_client.connected_clients.remove(self)
291
+ await self._reset()
292
+ raise exceptions.ConnectionError(
293
+ 'Connect handler failed: ' + str(exc))
288
294
 
289
295
  for pkt in p.packets[1:]:
290
296
  await self._receive_packet(pkt)
@@ -406,7 +412,13 @@ class AsyncClient(base_client.BaseClient):
406
412
 
407
413
  self.state = 'connected'
408
414
  base_client.connected_clients.append(self)
409
- await self._trigger_event('connect', run_async=False)
415
+ try:
416
+ await self._trigger_event('connect', run_async=False)
417
+ except Exception as exc:
418
+ base_client.connected_clients.remove(self)
419
+ await self._reset()
420
+ raise exceptions.ConnectionError(
421
+ 'Connect handler failed: ' + str(exc))
410
422
 
411
423
  self.ws = ws
412
424
  self.write_loop_task = self.start_background_task(self._write_loop)
@@ -495,9 +507,9 @@ class AsyncClient(base_client.BaseClient):
495
507
  except:
496
508
  self.logger.exception(event + ' async handler error')
497
509
  if event == 'connect':
498
- # if connect handler raised error we reject the
499
- # connection
500
- return False
510
+ # for the connection event we reraise the exception
511
+ # to stop the connection from completing
512
+ raise
501
513
  else:
502
514
  if run_async:
503
515
  async def async_handler():
@@ -522,9 +534,9 @@ class AsyncClient(base_client.BaseClient):
522
534
  except:
523
535
  self.logger.exception(event + ' handler error')
524
536
  if event == 'connect':
525
- # if connect handler raised error we reject the
526
- # connection
527
- return False
537
+ # for the connection event we reraise the exception
538
+ # to stop the connection from completing
539
+ raise
528
540
  return ret
529
541
 
530
542
  async def _read_loop_polling(self):
@@ -147,7 +147,8 @@ async def translate_request(scope, receive, send):
147
147
  while self.event.get('more_body'):
148
148
  self.event = await receive()
149
149
  if self.event['type'] == 'http.request':
150
- self.payload += self.event.get('body') or b''
150
+ if length is None or len(self.payload) < length:
151
+ self.payload += self.event.get('body') or b''
151
152
  if length is None:
152
153
  r = self.payload
153
154
  self.payload = b''
engineio/client.py CHANGED
@@ -229,7 +229,13 @@ class Client(base_client.BaseClient):
229
229
 
230
230
  self.state = 'connected'
231
231
  base_client.connected_clients.append(self)
232
- self._trigger_event('connect', run_async=False)
232
+ try:
233
+ self._trigger_event('connect', run_async=False, reraise=True)
234
+ except Exception as exc:
235
+ base_client.connected_clients.remove(self)
236
+ self._reset()
237
+ raise exceptions.ConnectionError(
238
+ 'Connect handler failed: ' + str(exc))
233
239
 
234
240
  for pkt in p.packets[1:]:
235
241
  self._receive_packet(pkt)
@@ -403,7 +409,13 @@ class Client(base_client.BaseClient):
403
409
 
404
410
  self.state = 'connected'
405
411
  base_client.connected_clients.append(self)
406
- self._trigger_event('connect', run_async=False)
412
+ try:
413
+ self._trigger_event('connect', run_async=False, reraise=True)
414
+ except Exception as exc:
415
+ base_client.connected_clients.remove(self)
416
+ self._reset()
417
+ raise exceptions.ConnectionError(
418
+ 'Connect handler failed: ' + str(exc))
407
419
  self.ws = ws
408
420
  self.ws.settimeout(self.ping_interval + self.ping_timeout)
409
421
 
@@ -477,6 +489,10 @@ class Client(base_client.BaseClient):
477
489
  raise
478
490
  except:
479
491
  self.logger.exception(event + ' handler error')
492
+ if event == 'connect':
493
+ # for the connection event we reraise the exception
494
+ # to stop the connection from completing
495
+ raise
480
496
 
481
497
  def _read_loop_polling(self):
482
498
  """Read packets by polling the Engine.IO server."""
@@ -0,0 +1,60 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-engineio
3
+ Version: 4.14.0
4
+ Summary: Engine.IO server and client for Python
5
+ Author-email: Miguel Grinberg <miguel.grinberg@gmail.com>
6
+ License: MIT
7
+ Project-URL: homepage, https://code.miguelgrinberg.com/miguelgrinberg/python-engineio
8
+ Project-URL: documentation, https://python-engineio.readthedocs.io/
9
+ Project-URL: repository, https://code.miguelgrinberg.com/miguelgrinberg/python-engineio
10
+ Project-URL: issues, https://github.com/miguelgrinberg/python-engineio/issues
11
+ Project-URL: changelog, https://code.miguelgrinberg.com/miguelgrinberg/python-engineio/src/branch/main/CHANGES.md
12
+ Classifier: Environment :: Web Environment
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Operating System :: OS Independent
16
+ Requires-Python: >=3.8
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: simple-websocket>=0.10.0
20
+ Provides-Extra: client
21
+ Requires-Dist: requests>=2.21.0; extra == "client"
22
+ Requires-Dist: websocket-client>=0.54.0; extra == "client"
23
+ Provides-Extra: asyncio-client
24
+ Requires-Dist: aiohttp>=3.11; extra == "asyncio-client"
25
+ Provides-Extra: dev
26
+ Requires-Dist: tox; extra == "dev"
27
+ Provides-Extra: docs
28
+ Requires-Dist: sphinx; extra == "docs"
29
+ Requires-Dist: furo; extra == "docs"
30
+ Dynamic: license-file
31
+
32
+ python-engineio
33
+ ===============
34
+
35
+ [![tests](https://code.miguelgrinberg.com/miguelgrinberg/python-engineio/badges/workflows/tests.yml/badge.svg)](https://code.miguelgrinberg.com/miguelgrinberg/python-engineio/actions)
36
+
37
+ Python implementation of the `Engine.IO` realtime client and server.
38
+
39
+ Resources
40
+ ---------
41
+
42
+ - [git](https://code.miguelgrinberg.com/miguelgrinberg/python-engineio)
43
+ - [Change Log](https://code.miguelgrinberg.com/miguelgrinberg/python-engineio/src/branch/main/CHANGES.md)
44
+ - [Documentation](https://python-engineio.readthedocs.io/)
45
+ - [PyPI](https://pypi.python.org/pypi/python-engineio)
46
+ - [Contributor's guide](CONTRIBUTING.md)
47
+ - [Security policy](SECURITY.md)
48
+
49
+ Sponsor this project
50
+ --------------------
51
+
52
+ This project relies on contributions from its users. If you benefit from it please consider making a single or ongoing monetary contribution in one of the following platforms:
53
+
54
+ - [Github Sponsors](https://github.com/sponsors/miguelgrinberg)
55
+ - [Patreon](https://patreon.com/miguelgrinberg)
56
+ - [Buy me a Coffee](https://buymeacoffee.com/miguelgrinberg)
57
+ - [thanks.dev](https://thanks.dev/u/gh/miguelgrinberg)
58
+ - [PayPal](https://paypal.me/miguelgrinberg)
59
+
60
+ Thank you!
@@ -1,11 +1,11 @@
1
1
  engineio/__init__.py,sha256=0R2PY1EXu3sicP7mkA0_QxEVGRlFlgvsxfhByqREE1A,481
2
- engineio/async_client.py,sha256=EsjojCmw1c6hJW7iyeR09QV0SvpbETO8btKGGgugaxM,29989
2
+ engineio/async_client.py,sha256=MuqDjXx7W-Fe8dr29kncI-2BMO0XzvqZHdZ2-kmJThQ,30539
3
3
  engineio/async_server.py,sha256=7oQClUwwSiPlFFUSEBeE6VuOYnbK2z8FCmRqeWoiiVE,27558
4
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
7
  engineio/base_socket.py,sha256=PWiJC1msNo-0ctlP3JAwWsngKvnYM-ZjS6B6zzfu-eM,420
8
- engineio/client.py,sha256=Ic4wZ_81bSEWSe86pL65B21pWj54wi0fgrrND0lP858,28525
8
+ engineio/client.py,sha256=STXw-UI3CD9VizbT6A3bbyL2_a1mpRm8TiU6fxJJg7Q,29255
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=8kutiYG0syg3rFeqzMU3Pm-QQwaUx0F9EUUaOfKwPAU,1026
19
19
  engineio/async_drivers/aiohttp.py,sha256=SOU9KOoru_OzxLioSKCYNIZQZLoyf-oxw6-bXc6-_L8,3697
20
- engineio/async_drivers/asgi.py,sha256=9qAPXs4wO4TxTyF-Se-nhilqzufj9on63MWM66D4j0g,11535
20
+ engineio/async_drivers/asgi.py,sha256=7SkakRQTc9UGa2h4F-m40UlNewmAQ1H5bZHgTs7tS20,11612
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.4.dist-info/licenses/LICENSE,sha256=yel9Pbwfu82094CLKCzWRtuIev9PUxP-a76NTDFAWpw,1082
28
- python_engineio-4.13.4.dist-info/METADATA,sha256=kwlxmJbdP31tao1XgtOWrFE6BKRMMwW0Ms2soquTLPM,2314
29
- python_engineio-4.13.4.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
30
- python_engineio-4.13.4.dist-info/top_level.txt,sha256=u8PmNisCZLwRYcWrNLe9wutQ2tt4zNi8IH362c-HWuA,9
31
- python_engineio-4.13.4.dist-info/RECORD,,
27
+ python_engineio-4.14.0.dist-info/licenses/LICENSE,sha256=yel9Pbwfu82094CLKCzWRtuIev9PUxP-a76NTDFAWpw,1082
28
+ python_engineio-4.14.0.dist-info/METADATA,sha256=QZLd2QwRscNvl5JYnURoE2Zu0RhcE5dd_tt4plhmZfA,2496
29
+ python_engineio-4.14.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
30
+ python_engineio-4.14.0.dist-info/top_level.txt,sha256=u8PmNisCZLwRYcWrNLe9wutQ2tt4zNi8IH362c-HWuA,9
31
+ python_engineio-4.14.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (83.0.0)
2
+ Generator: setuptools (84.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,52 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: python-engineio
3
- Version: 4.13.4
4
- Summary: Engine.IO server and client for Python
5
- Author-email: Miguel Grinberg <miguel.grinberg@gmail.com>
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/miguelgrinberg/python-engineio
8
- Project-URL: Bug Tracker, https://github.com/miguelgrinberg/python-engineio/issues
9
- Classifier: Environment :: Web Environment
10
- Classifier: Intended Audience :: Developers
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Operating System :: OS Independent
13
- Requires-Python: >=3.8
14
- Description-Content-Type: text/markdown
15
- License-File: LICENSE
16
- Requires-Dist: simple-websocket>=0.10.0
17
- Provides-Extra: client
18
- Requires-Dist: requests>=2.21.0; extra == "client"
19
- Requires-Dist: websocket-client>=0.54.0; extra == "client"
20
- Provides-Extra: asyncio-client
21
- Requires-Dist: aiohttp>=3.11; extra == "asyncio-client"
22
- Provides-Extra: dev
23
- Requires-Dist: tox; extra == "dev"
24
- Provides-Extra: docs
25
- Requires-Dist: sphinx; extra == "docs"
26
- Requires-Dist: furo; extra == "docs"
27
- Dynamic: license-file
28
-
29
- python-engineio
30
- ===============
31
-
32
- [![Build status](https://github.com/miguelgrinberg/python-engineio/workflows/build/badge.svg)](https://github.com/miguelgrinberg/python-engineio/actions) [![codecov](https://codecov.io/gh/miguelgrinberg/python-engineio/branch/main/graph/badge.svg)](https://codecov.io/gh/miguelgrinberg/python-engineio)
33
-
34
- Python implementation of the `Engine.IO` realtime client and server.
35
-
36
- Sponsors
37
- --------
38
-
39
- The following organizations are funding this project:
40
-
41
- ![Socket.IO](https://images.opencollective.com/socketio/050e5eb/logo/64.png)<br>[Socket.IO](https://socket.io) | [Add your company here!](https://github.com/sponsors/miguelgrinberg)|
42
- -|-
43
-
44
- Many individual sponsors also support this project through small ongoing contributions. Why not [join them](https://github.com/sponsors/miguelgrinberg)?
45
-
46
- Resources
47
- ---------
48
-
49
- - [Documentation](https://python-engineio.readthedocs.io/)
50
- - [PyPI](https://pypi.python.org/pypi/python-engineio)
51
- - [Change Log](https://github.com/miguelgrinberg/python-engineio/blob/main/CHANGES.md)
52
- - Questions? See the [questions](https://stackoverflow.com/questions/tagged/python-socketio) others have asked on Stack Overflow, or [ask](https://stackoverflow.com/questions/ask?tags=python+python-socketio) your own question.