jellezijlstra / aiohttp-sse-client2 Goto Github PK
View Code? Open in Web Editor NEWThis project forked from rtfol/aiohttp-sse-client
Server-Sent Event python client library based on aiohttp
License: Other
This project forked from rtfol/aiohttp-sse-client
Server-Sent Event python client library based on aiohttp
License: Other
I have the following code
try:
async with sse_client.EventSource(self.listen_for_messages_url()) as event_source:
async for event in event_source:
app_log.debug("Received SSE %s with data %s" % (event.type, event.data))
# only process put and patch events
if event.type in ["put", "patch"]:
self.message_capture(event.data)
except ConnectionError:
app_log.error("ConnectionError: %s" % traceback.format_exc())
except TimeoutError:
app_log.error("TimeoutError: %s" % traceback.format_exc())
except RuntimeError:
app_log.error("RuntimeError: %s" % traceback.format_exc())
except Exception:
app_log.error("UnexpectedError: %s" % traceback.format_exc())
Occasionally I see TimeoutErrors, but the code records fine in most cases. Somehow now I'm getting the following RuntimeError after a TimeoutError (I'm not sure if they're related).
2024-01-30 08:06:25,201 ERROR /home/mm/.ctrlenv/lib/python3.11/site-packages/mm_controller/cloud.py :: message_reader(196) RuntimeError: Traceback (most recent call last):
File "/home/mm/.ctrlenv/lib/python3.11/site-packages/mm_controller/cloud.py", line 185, in message_reader
async with sse_client.EventSource(self.listen_for_messages_url()) as event_source:
File "/home/mm/.ctrlenv/lib/python3.11/site-packages/aiohttp_sse_client2/client.py", line 126, in __aenter__
await self.connect(self._max_connect_retry)
File "/home/mm/.ctrlenv/lib/python3.11/site-packages/aiohttp_sse_client2/client.py", line 214, in connect
response = await self._session.request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mm/.ctrlenv/lib/python3.11/site-packages/aiohttp/client.py", line 574, in _request
conn = await self._connector.connect(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mm/.ctrlenv/lib/python3.11/site-packages/aiohttp/connector.py", line 544, in connect
proto = await self._create_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mm/.ctrlenv/lib/python3.11/site-packages/aiohttp/connector.py", line 911, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mm/.ctrlenv/lib/python3.11/site-packages/aiohttp/connector.py", line 1173, in _create_direct_connection
hosts = await asyncio.shield(host_resolved)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mm/.ctrlenv/lib/python3.11/site-packages/aiohttp/connector.py", line 884, in _resolve_host
addrs = await self._resolver.resolve(host, port, family=self._family)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mm/.ctrlenv/lib/python3.11/site-packages/aiohttp/resolver.py", line 33, in resolve
infos = await self._loop.getaddrinfo(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/base_events.py", line 867, in getaddrinfo
return await self.run_in_executor(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/base_events.py", line 829, in run_in_executor
executor.submit(func, *args), loop=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/concurrent/futures/thread.py", line 169, in submit
raise RuntimeError('cannot schedule new futures after '
RuntimeError: cannot schedule new futures after interpreter shutdown
Any ideas where to look to fix this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.