microdot 2.3.4__tar.gz → 2.3.5__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.
- {microdot-2.3.4/src/microdot.egg-info → microdot-2.3.5}/PKG-INFO +1 -1
- {microdot-2.3.4 → microdot-2.3.5}/pyproject.toml +1 -1
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot/asgi.py +2 -0
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot/microdot.py +0 -1
- microdot-2.3.5/src/microdot/pubsub.py +21 -0
- {microdot-2.3.4 → microdot-2.3.5/src/microdot.egg-info}/PKG-INFO +1 -1
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot.egg-info/SOURCES.txt +1 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/test_asgi.py +1 -1
- {microdot-2.3.4 → microdot-2.3.5}/LICENSE +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/MANIFEST.in +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/README.md +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/docs/Makefile +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/docs/_static/css/custom.css +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/docs/api.rst +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/docs/conf.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/docs/extensions.rst +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/docs/freezing.rst +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/docs/index.rst +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/docs/intro.rst +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/docs/make.bat +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/docs/migrating.rst +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/setup.cfg +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot/__init__.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot/auth.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot/cors.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot/helpers.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot/jinja.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot/login.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot/multipart.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot/session.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot/sse.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot/test_client.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot/utemplate.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot/websocket.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot/wsgi.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot.egg-info/dependency_links.txt +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot.egg-info/not-zip-safe +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot.egg-info/requires.txt +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/src/microdot.egg-info/top_level.txt +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/__init__.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/files/test.bin +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/files/test.css +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/files/test.gif +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/files/test.gz +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/files/test.html +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/files/test.jpg +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/files/test.js +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/files/test.json +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/files/test.png +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/files/test.txt +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/files/test.txt.gz +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/mock_socket.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/templates/hello.jinja.txt +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/templates/hello.utemplate.txt +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/templates/hello_utemplate_txt.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/test_auth.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/test_cors.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/test_end2end.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/test_jinja.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/test_login.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/test_microdot.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/test_multidict.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/test_multipart.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/test_request.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/test_response.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/test_session.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/test_sse.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/test_url_pattern.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/test_urlencode.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/test_utemplate.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/test_websocket.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tests/test_wsgi.py +0 -0
- {microdot-2.3.4 → microdot-2.3.5}/tox.ini +0 -0
|
@@ -130,6 +130,8 @@ class Microdot(BaseMicrodot):
|
|
|
130
130
|
try:
|
|
131
131
|
while not cancelled: # pragma: no branch
|
|
132
132
|
res_body = await body_iter.__anext__()
|
|
133
|
+
if isinstance(res_body, str):
|
|
134
|
+
res_body = res_body.encode()
|
|
133
135
|
await send({'type': 'http.response.body',
|
|
134
136
|
'body': res_body,
|
|
135
137
|
'more_body': True})
|
|
@@ -944,7 +944,6 @@ class Microdot:
|
|
|
944
944
|
self.after_request_handlers = []
|
|
945
945
|
self.after_error_request_handlers = []
|
|
946
946
|
self.error_handlers = {}
|
|
947
|
-
self.shutdown_requested = False
|
|
948
947
|
self.options_handler = self.default_options_handler
|
|
949
948
|
self.debug = False
|
|
950
949
|
self.server = None
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
class PubSub:
|
|
2
|
+
subscriptions = {}
|
|
3
|
+
|
|
4
|
+
def subscribe(self, observer, topic):
|
|
5
|
+
if topic not in self.subscriptions:
|
|
6
|
+
self.subscriptions[topic] = []
|
|
7
|
+
self.subscriptions[topic].append(observer)
|
|
8
|
+
|
|
9
|
+
def unsubscribe(self, observer, topic):
|
|
10
|
+
if topic in self.subscriptions:
|
|
11
|
+
try:
|
|
12
|
+
self.subscriptions[topic].remove(observer)
|
|
13
|
+
if not self.subscriptions[topic]:
|
|
14
|
+
del self.subscriptions[topic]
|
|
15
|
+
except (ValueError, IndexError):
|
|
16
|
+
pass
|
|
17
|
+
|
|
18
|
+
@classmethod
|
|
19
|
+
async def publish(cls, topic, data):
|
|
20
|
+
for observer in cls.subscriptions.get(topic, []):
|
|
21
|
+
await observer.send(data, event=topic)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|