python-socketio 5.14.2__tar.gz → 5.14.3__tar.gz

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.
Files changed (87) hide show
  1. {python_socketio-5.14.2/src/python_socketio.egg-info → python_socketio-5.14.3}/PKG-INFO +1 -1
  2. {python_socketio-5.14.2 → python_socketio-5.14.3}/docs/server.rst +2 -0
  3. {python_socketio-5.14.2 → python_socketio-5.14.3}/pyproject.toml +1 -1
  4. {python_socketio-5.14.2 → python_socketio-5.14.3/src/python_socketio.egg-info}/PKG-INFO +1 -1
  5. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/async_aiopika_manager.py +1 -1
  6. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/async_server.py +3 -0
  7. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/server.py +3 -0
  8. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/async/test_server.py +15 -0
  9. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/common/test_server.py +14 -0
  10. {python_socketio-5.14.2 → python_socketio-5.14.3}/LICENSE +0 -0
  11. {python_socketio-5.14.2 → python_socketio-5.14.3}/MANIFEST.in +0 -0
  12. {python_socketio-5.14.2 → python_socketio-5.14.3}/README.md +0 -0
  13. {python_socketio-5.14.2 → python_socketio-5.14.3}/docs/Makefile +0 -0
  14. {python_socketio-5.14.2 → python_socketio-5.14.3}/docs/_static/README.md +0 -0
  15. {python_socketio-5.14.2 → python_socketio-5.14.3}/docs/_static/custom.css +0 -0
  16. {python_socketio-5.14.2 → python_socketio-5.14.3}/docs/api.rst +0 -0
  17. {python_socketio-5.14.2 → python_socketio-5.14.3}/docs/client.rst +0 -0
  18. {python_socketio-5.14.2 → python_socketio-5.14.3}/docs/conf.py +0 -0
  19. {python_socketio-5.14.2 → python_socketio-5.14.3}/docs/index.rst +0 -0
  20. {python_socketio-5.14.2 → python_socketio-5.14.3}/docs/intro.rst +0 -0
  21. {python_socketio-5.14.2 → python_socketio-5.14.3}/docs/make.bat +0 -0
  22. {python_socketio-5.14.2 → python_socketio-5.14.3}/setup.cfg +0 -0
  23. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/python_socketio.egg-info/SOURCES.txt +0 -0
  24. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/python_socketio.egg-info/dependency_links.txt +0 -0
  25. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/python_socketio.egg-info/not-zip-safe +0 -0
  26. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/python_socketio.egg-info/requires.txt +0 -0
  27. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/python_socketio.egg-info/top_level.txt +0 -0
  28. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/__init__.py +0 -0
  29. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/admin.py +0 -0
  30. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/asgi.py +0 -0
  31. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/async_admin.py +0 -0
  32. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/async_client.py +0 -0
  33. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/async_manager.py +0 -0
  34. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/async_namespace.py +0 -0
  35. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/async_pubsub_manager.py +0 -0
  36. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/async_redis_manager.py +0 -0
  37. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/async_simple_client.py +0 -0
  38. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/base_client.py +0 -0
  39. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/base_manager.py +0 -0
  40. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/base_namespace.py +0 -0
  41. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/base_server.py +0 -0
  42. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/client.py +0 -0
  43. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/exceptions.py +0 -0
  44. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/kafka_manager.py +0 -0
  45. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/kombu_manager.py +0 -0
  46. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/manager.py +0 -0
  47. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/middleware.py +0 -0
  48. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/msgpack_packet.py +0 -0
  49. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/namespace.py +0 -0
  50. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/packet.py +0 -0
  51. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/pubsub_manager.py +0 -0
  52. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/redis_manager.py +0 -0
  53. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/simple_client.py +0 -0
  54. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/tornado.py +0 -0
  55. {python_socketio-5.14.2 → python_socketio-5.14.3}/src/socketio/zmq_manager.py +0 -0
  56. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/__init__.py +0 -0
  57. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/async/__init__.py +0 -0
  58. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/async/test_admin.py +0 -0
  59. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/async/test_client.py +0 -0
  60. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/async/test_manager.py +0 -0
  61. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/async/test_namespace.py +0 -0
  62. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/async/test_pubsub_manager.py +0 -0
  63. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/async/test_redis_manager.py +0 -0
  64. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/async/test_simple_client.py +0 -0
  65. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/asyncio_web_server.py +0 -0
  66. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/common/__init__.py +0 -0
  67. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/common/test_admin.py +0 -0
  68. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/common/test_client.py +0 -0
  69. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/common/test_manager.py +0 -0
  70. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/common/test_middleware.py +0 -0
  71. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/common/test_msgpack_packet.py +0 -0
  72. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/common/test_namespace.py +0 -0
  73. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/common/test_packet.py +0 -0
  74. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/common/test_pubsub_manager.py +0 -0
  75. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/common/test_redis_manager.py +0 -0
  76. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/common/test_simple_client.py +0 -0
  77. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/performance/README.md +0 -0
  78. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/performance/binary_packet.py +0 -0
  79. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/performance/json_packet.py +0 -0
  80. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/performance/namespace_packet.py +0 -0
  81. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/performance/run.sh +0 -0
  82. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/performance/server_receive.py +0 -0
  83. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/performance/server_send.py +0 -0
  84. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/performance/server_send_broadcast.py +0 -0
  85. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/performance/text_packet.py +0 -0
  86. {python_socketio-5.14.2 → python_socketio-5.14.3}/tests/web_server.py +0 -0
  87. {python_socketio-5.14.2 → python_socketio-5.14.3}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-socketio
3
- Version: 5.14.2
3
+ Version: 5.14.3
4
4
  Summary: Socket.IO server and client for Python
5
5
  Author-email: Miguel Grinberg <miguel.grinberg@gmail.com>
6
6
  License: MIT
@@ -246,6 +246,8 @@ a :class:`socketio.exceptions.ConnectionRefusedError` exception can be raised,
246
246
  and all of its arguments will be sent to the client with the rejection
247
247
  message::
248
248
 
249
+ from socketio.exceptions import ConnectionRefusedError
250
+
249
251
  @sio.event
250
252
  def connect(sid, environ, auth):
251
253
  raise ConnectionRefusedError('authentication failed')
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "python-socketio"
3
- version = "5.14.2"
3
+ version = "5.14.3"
4
4
  license = {text = "MIT"}
5
5
  authors = [
6
6
  { name = "Miguel Grinberg", email = "miguel.grinberg@gmail.com" },
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-socketio
3
- Version: 5.14.2
3
+ Version: 5.14.3
4
4
  Summary: Socket.IO server and client for Python
5
5
  Author-email: Miguel Grinberg <miguel.grinberg@gmail.com>
6
6
  License: MIT
@@ -82,7 +82,7 @@ class AsyncAioPikaManager(AsyncPubSubManager): # pragma: no cover
82
82
  try:
83
83
  await self.publisher_exchange.publish(
84
84
  aio_pika.Message(
85
- body=json.dumps(data),
85
+ body=json.dumps(data).encode(),
86
86
  delivery_mode=aio_pika.DeliveryMode.PERSISTENT
87
87
  ), routing_key='*',
88
88
  )
@@ -561,6 +561,9 @@ class AsyncServer(base_server.BaseServer):
561
561
  except exceptions.ConnectionRefusedError as exc:
562
562
  fail_reason = exc.error_args
563
563
  success = False
564
+ except ConnectionRefusedError:
565
+ fail_reason = {"message": "Connection refused by server"}
566
+ success = False
564
567
 
565
568
  if success is False:
566
569
  if self.always_connect:
@@ -543,6 +543,9 @@ class Server(base_server.BaseServer):
543
543
  except exceptions.ConnectionRefusedError as exc:
544
544
  fail_reason = exc.error_args
545
545
  success = False
546
+ except ConnectionRefusedError:
547
+ fail_reason = {"message": "Connection refused by server"}
548
+ success = False
546
549
 
547
550
  if success is False:
548
551
  if self.always_connect:
@@ -482,6 +482,21 @@ class TestAsyncServer:
482
482
  '123', '4{"message":"fail_reason"}')
483
483
  assert s.environ == {'123': 'environ'}
484
484
 
485
+ async def test_handle_connect_rejected_with_python_exception(self, eio):
486
+ eio.return_value.send = mock.AsyncMock()
487
+ s = async_server.AsyncServer()
488
+ handler = mock.MagicMock(
489
+ side_effect=ConnectionRefusedError()
490
+ )
491
+ s.on('connect', handler)
492
+ await s._handle_eio_connect('123', 'environ')
493
+ await s._handle_eio_message('123', '0')
494
+ assert not s.manager.is_connected('1', '/')
495
+ handler.assert_called_once_with('1', 'environ')
496
+ s.eio.send.assert_awaited_once_with(
497
+ '123', '4{"message":"Connection refused by server"}')
498
+ assert s.environ == {'123': 'environ'}
499
+
485
500
  async def test_handle_connect_rejected_with_empty_exception(self, eio):
486
501
  eio.return_value.send = mock.AsyncMock()
487
502
  s = async_server.AsyncServer()
@@ -462,6 +462,20 @@ class TestServer:
462
462
  s.eio.send.assert_called_once_with('123', '4{"message":"fail_reason"}')
463
463
  assert s.environ == {'123': 'environ'}
464
464
 
465
+ def test_handle_connect_rejected_with_python_exception(self, eio):
466
+ s = server.Server()
467
+ handler = mock.MagicMock(
468
+ side_effect=ConnectionRefusedError()
469
+ )
470
+ s.on('connect', handler)
471
+ s._handle_eio_connect('123', 'environ')
472
+ s._handle_eio_message('123', '0')
473
+ assert not s.manager.is_connected('1', '/')
474
+ handler.assert_called_once_with('1', 'environ')
475
+ s.eio.send.assert_called_once_with(
476
+ '123', '4{"message":"Connection refused by server"}')
477
+ assert s.environ == {'123': 'environ'}
478
+
465
479
  def test_handle_connect_rejected_with_empty_exception(self, eio):
466
480
  s = server.Server()
467
481
  handler = mock.MagicMock(