Flask-SocketIO 5.6.1__tar.gz → 5.7.1__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 (32) hide show
  1. flask_socketio-5.7.1/PKG-INFO +98 -0
  2. flask_socketio-5.7.1/README.md +60 -0
  3. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/docs/getting_started.rst +11 -0
  4. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/pyproject.toml +9 -5
  5. flask_socketio-5.7.1/src/Flask_SocketIO.egg-info/PKG-INFO +98 -0
  6. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/src/Flask_SocketIO.egg-info/SOURCES.txt +0 -0
  7. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/src/Flask_SocketIO.egg-info/dependency_links.txt +0 -0
  8. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/src/Flask_SocketIO.egg-info/not-zip-safe +0 -0
  9. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/src/Flask_SocketIO.egg-info/requires.txt +1 -1
  10. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/src/Flask_SocketIO.egg-info/top_level.txt +0 -0
  11. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/src/flask_socketio/__init__.py +1 -1
  12. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/src/flask_socketio/namespace.py +13 -7
  13. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/test_socketio.py +172 -181
  14. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/tox.ini +19 -13
  15. flask_socketio-5.6.1/PKG-INFO +0 -80
  16. flask_socketio-5.6.1/README.md +0 -46
  17. flask_socketio-5.6.1/src/Flask_SocketIO.egg-info/PKG-INFO +0 -80
  18. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/LICENSE +0 -0
  19. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/MANIFEST.in +0 -0
  20. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/docs/Makefile +0 -0
  21. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/docs/_static/README.md +0 -0
  22. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/docs/_static/custom.css +0 -0
  23. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/docs/api.rst +0 -0
  24. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/docs/conf.py +0 -0
  25. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/docs/deployment.rst +0 -0
  26. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/docs/implementation_notes.rst +0 -0
  27. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/docs/index.rst +0 -0
  28. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/docs/intro.rst +0 -0
  29. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/docs/make.bat +0 -0
  30. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/docs/upgrading.rst +0 -0
  31. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/setup.cfg +0 -0
  32. {flask_socketio-5.6.1 → flask_socketio-5.7.1}/src/flask_socketio/test_client.py +0 -0
@@ -0,0 +1,98 @@
1
+ Metadata-Version: 2.4
2
+ Name: Flask-SocketIO
3
+ Version: 5.7.1
4
+ Summary: Socket.IO integration for Flask applications
5
+ Author-email: Miguel Grinberg <miguel.grinberg@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio
8
+ Project-URL: Documentation, https://flask-socketio.readthedocs.io/
9
+ Project-URL: Source Code, https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio
10
+ Project-URL: Issue Tracker, https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio/issues
11
+ Project-URL: Changelog, https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio/src/branch/main/CHANGES.md
12
+ Project-URL: Funding, https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio#sponsor-this-project
13
+ Classifier: Environment :: Web Environment
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Operating System :: OS Independent
17
+ Requires-Python: >=3.8
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: blinker
21
+ Requires-Dist: click
22
+ Requires-Dist: flask
23
+ Requires-Dist: Flask>=2.1.0
24
+ Requires-Dist: jinja2
25
+ Requires-Dist: python-socketio>=5.18.0
26
+ Requires-Dist: werkzeug
27
+ Provides-Extra: docs
28
+ Requires-Dist: sphinx; extra == "docs"
29
+ Requires-Dist: furo; extra == "docs"
30
+ Provides-Extra: dev
31
+ Requires-Dist: flask-login; extra == "dev"
32
+ Requires-Dist: flask-session; extra == "dev"
33
+ Requires-Dist: pytest; extra == "dev"
34
+ Requires-Dist: pytest-cov; extra == "dev"
35
+ Requires-Dist: redis; extra == "dev"
36
+ Requires-Dist: tox; extra == "dev"
37
+ Dynamic: license-file
38
+
39
+ Flask-SocketIO
40
+ ==============
41
+
42
+ [![tests](https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio/badges/workflows/tests.yml/badge.svg)](https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio/actions)
43
+
44
+ Socket.IO integration for Flask applications.
45
+
46
+ Installation
47
+ ------------
48
+
49
+ You can install this package as usual with pip:
50
+
51
+ pip install flask-socketio
52
+
53
+ Example
54
+ -------
55
+
56
+ ```py
57
+ from flask import Flask, render_template
58
+ from flask_socketio import SocketIO, emit
59
+
60
+ app = Flask(__name__)
61
+ app.config['SECRET_KEY'] = 'secret!'
62
+ socketio = SocketIO(app)
63
+
64
+ @app.route('/')
65
+ def index():
66
+ return render_template('index.html')
67
+
68
+ @socketio.event
69
+ def my_event(message):
70
+ emit('my response', {'data': 'got it!'})
71
+
72
+ if __name__ == '__main__':
73
+ socketio.run(app)
74
+ ```
75
+
76
+ Resources
77
+ ---------
78
+
79
+ - [Tutorial](http://blog.miguelgrinberg.com/post/easy-websockets-with-flask-and-gevent)
80
+ - [git](https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio)
81
+ - [Change Log](https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio/src/branch/main/CHANGES.md)
82
+ - [Documentation](https://flask-socketio.readthedocs.io/)
83
+ - [PyPI](https://pypi.python.org/pypi/flask-socketio)
84
+ - [Contributor's guide](CONTRIBUTING.md)
85
+ - [Security policy](SECURITY.md)
86
+
87
+ Sponsor this project
88
+ --------------------
89
+
90
+ 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:
91
+
92
+ - [Github Sponsors](https://github.com/sponsors/miguelgrinberg)
93
+ - [Patreon](https://patreon.com/miguelgrinberg)
94
+ - [Buy me a Coffee](https://buymeacoffee.com/miguelgrinberg)
95
+ - [thanks.dev](https://thanks.dev/u/gh/miguelgrinberg)
96
+ - [PayPal](https://paypal.me/miguelgrinberg)
97
+
98
+ Thank you!
@@ -0,0 +1,60 @@
1
+ Flask-SocketIO
2
+ ==============
3
+
4
+ [![tests](https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio/badges/workflows/tests.yml/badge.svg)](https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio/actions)
5
+
6
+ Socket.IO integration for Flask applications.
7
+
8
+ Installation
9
+ ------------
10
+
11
+ You can install this package as usual with pip:
12
+
13
+ pip install flask-socketio
14
+
15
+ Example
16
+ -------
17
+
18
+ ```py
19
+ from flask import Flask, render_template
20
+ from flask_socketio import SocketIO, emit
21
+
22
+ app = Flask(__name__)
23
+ app.config['SECRET_KEY'] = 'secret!'
24
+ socketio = SocketIO(app)
25
+
26
+ @app.route('/')
27
+ def index():
28
+ return render_template('index.html')
29
+
30
+ @socketio.event
31
+ def my_event(message):
32
+ emit('my response', {'data': 'got it!'})
33
+
34
+ if __name__ == '__main__':
35
+ socketio.run(app)
36
+ ```
37
+
38
+ Resources
39
+ ---------
40
+
41
+ - [Tutorial](http://blog.miguelgrinberg.com/post/easy-websockets-with-flask-and-gevent)
42
+ - [git](https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio)
43
+ - [Change Log](https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio/src/branch/main/CHANGES.md)
44
+ - [Documentation](https://flask-socketio.readthedocs.io/)
45
+ - [PyPI](https://pypi.python.org/pypi/flask-socketio)
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!
@@ -384,6 +384,17 @@ debugging outside the event handler::
384
384
  print(request.event["message"]) # "my error event"
385
385
  print(request.event["args"]) # (data,)
386
386
 
387
+ When using class-based namespaces, an error handler for the namespace can be
388
+ added as a method named ``error()``::
389
+
390
+ class MyCustomNamespace(Namespace):
391
+ # ...
392
+
393
+ def error(self, error):
394
+ print(f'Error {error} on event {request.event}'
395
+
396
+ socketio.on_namespace(MyCustomNamespace('/test'))
397
+
387
398
  Debugging and Troubleshooting
388
399
  -----------------------------
389
400
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "Flask-SocketIO"
3
- version = "5.6.1"
3
+ version = "5.7.1"
4
4
  authors = [
5
5
  { name = "Miguel Grinberg", email = "miguel.grinberg@gmail.com" },
6
6
  ]
@@ -9,9 +9,9 @@ classifiers = [
9
9
  "Environment :: Web Environment",
10
10
  "Intended Audience :: Developers",
11
11
  "Programming Language :: Python :: 3",
12
- "License :: OSI Approved :: MIT License",
13
12
  "Operating System :: OS Independent",
14
13
  ]
14
+ license = "MIT"
15
15
  requires-python = ">=3.8"
16
16
  dependencies = [
17
17
  "blinker",
@@ -19,7 +19,7 @@ dependencies = [
19
19
  "flask",
20
20
  "Flask >= 2.1.0",
21
21
  "jinja2",
22
- "python-socketio >= 5.12.0",
22
+ "python-socketio >= 5.18.0",
23
23
  "werkzeug",
24
24
  ]
25
25
 
@@ -28,8 +28,12 @@ file = "README.md"
28
28
  content-type = "text/markdown"
29
29
 
30
30
  [project.urls]
31
- Homepage = "https://github.com/miguelgrinberg/flask-socketio"
32
- "Bug Tracker" = "https://github.com/miguelgrinberg/flask-socketio/issues"
31
+ Homepage = "https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio"
32
+ Documentation = "https://flask-socketio.readthedocs.io/"
33
+ "Source Code" = "https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio"
34
+ "Issue Tracker" = "https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio/issues"
35
+ Changelog = "https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio/src/branch/main/CHANGES.md"
36
+ Funding = "https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio#sponsor-this-project"
33
37
 
34
38
  [project.optional-dependencies]
35
39
  docs = [
@@ -0,0 +1,98 @@
1
+ Metadata-Version: 2.4
2
+ Name: Flask-SocketIO
3
+ Version: 5.7.1
4
+ Summary: Socket.IO integration for Flask applications
5
+ Author-email: Miguel Grinberg <miguel.grinberg@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio
8
+ Project-URL: Documentation, https://flask-socketio.readthedocs.io/
9
+ Project-URL: Source Code, https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio
10
+ Project-URL: Issue Tracker, https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio/issues
11
+ Project-URL: Changelog, https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio/src/branch/main/CHANGES.md
12
+ Project-URL: Funding, https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio#sponsor-this-project
13
+ Classifier: Environment :: Web Environment
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Operating System :: OS Independent
17
+ Requires-Python: >=3.8
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: blinker
21
+ Requires-Dist: click
22
+ Requires-Dist: flask
23
+ Requires-Dist: Flask>=2.1.0
24
+ Requires-Dist: jinja2
25
+ Requires-Dist: python-socketio>=5.18.0
26
+ Requires-Dist: werkzeug
27
+ Provides-Extra: docs
28
+ Requires-Dist: sphinx; extra == "docs"
29
+ Requires-Dist: furo; extra == "docs"
30
+ Provides-Extra: dev
31
+ Requires-Dist: flask-login; extra == "dev"
32
+ Requires-Dist: flask-session; extra == "dev"
33
+ Requires-Dist: pytest; extra == "dev"
34
+ Requires-Dist: pytest-cov; extra == "dev"
35
+ Requires-Dist: redis; extra == "dev"
36
+ Requires-Dist: tox; extra == "dev"
37
+ Dynamic: license-file
38
+
39
+ Flask-SocketIO
40
+ ==============
41
+
42
+ [![tests](https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio/badges/workflows/tests.yml/badge.svg)](https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio/actions)
43
+
44
+ Socket.IO integration for Flask applications.
45
+
46
+ Installation
47
+ ------------
48
+
49
+ You can install this package as usual with pip:
50
+
51
+ pip install flask-socketio
52
+
53
+ Example
54
+ -------
55
+
56
+ ```py
57
+ from flask import Flask, render_template
58
+ from flask_socketio import SocketIO, emit
59
+
60
+ app = Flask(__name__)
61
+ app.config['SECRET_KEY'] = 'secret!'
62
+ socketio = SocketIO(app)
63
+
64
+ @app.route('/')
65
+ def index():
66
+ return render_template('index.html')
67
+
68
+ @socketio.event
69
+ def my_event(message):
70
+ emit('my response', {'data': 'got it!'})
71
+
72
+ if __name__ == '__main__':
73
+ socketio.run(app)
74
+ ```
75
+
76
+ Resources
77
+ ---------
78
+
79
+ - [Tutorial](http://blog.miguelgrinberg.com/post/easy-websockets-with-flask-and-gevent)
80
+ - [git](https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio)
81
+ - [Change Log](https://code.miguelgrinberg.com/miguelgrinberg/flask-socketio/src/branch/main/CHANGES.md)
82
+ - [Documentation](https://flask-socketio.readthedocs.io/)
83
+ - [PyPI](https://pypi.python.org/pypi/flask-socketio)
84
+ - [Contributor's guide](CONTRIBUTING.md)
85
+ - [Security policy](SECURITY.md)
86
+
87
+ Sponsor this project
88
+ --------------------
89
+
90
+ 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:
91
+
92
+ - [Github Sponsors](https://github.com/sponsors/miguelgrinberg)
93
+ - [Patreon](https://patreon.com/miguelgrinberg)
94
+ - [Buy me a Coffee](https://buymeacoffee.com/miguelgrinberg)
95
+ - [thanks.dev](https://thanks.dev/u/gh/miguelgrinberg)
96
+ - [PayPal](https://paypal.me/miguelgrinberg)
97
+
98
+ Thank you!
@@ -3,7 +3,7 @@ click
3
3
  flask
4
4
  Flask>=2.1.0
5
5
  jinja2
6
- python-socketio>=5.12.0
6
+ python-socketio>=5.18.0
7
7
  werkzeug
8
8
 
9
9
  [dev]
@@ -858,7 +858,7 @@ class SocketIO:
858
858
  ret = handler(*args)
859
859
  except ConnectionRefusedError:
860
860
  raise # let this error bubble up to python-socketio
861
- except:
861
+ except Exception:
862
862
  err_handler = self.exception_handlers.get(
863
863
  namespace, self.default_exception_handler)
864
864
  if err_handler is None:
@@ -23,13 +23,19 @@ class Namespace(_Namespace):
23
23
  return
24
24
  handler = getattr(self, handler_name)
25
25
  try:
26
- return self.socketio._handle_event(handler, event, self.namespace,
27
- *args)
28
- except TypeError:
29
- if event == 'disconnect':
30
- # legacy disconnect events do not have the reason argument
31
- return self.socketio._handle_event(
32
- handler, event, self.namespace, *args[:-1])
26
+ try:
27
+ return self.socketio._handle_event(handler, event,
28
+ self.namespace, *args)
29
+ except TypeError:
30
+ if event == 'disconnect':
31
+ # legacy disconnect events do not have the reason argument
32
+ return self.socketio._handle_event(
33
+ handler, event, self.namespace, *args[:-1])
34
+ else:
35
+ raise
36
+ except Exception as exc:
37
+ if hasattr(self, 'error'):
38
+ return self.error(exc)
33
39
  else:
34
40
  raise
35
41