-
Notifications
You must be signed in to change notification settings - Fork 163
Open
Description
My project runs a subclass of StreamListener in a thread that listens for on_notification and on_conversation. It has been working fine for a couple years, but just recently I've been noticing spam for the following error (truncated to the relevant info):
File "/home/astrelion/Projects/dungeons-bot/.venv/lib/python3.13/site-packages/mastodon/versions.py", line 50, in wrapper
return function(self, *args, **kwargs)
File "/home/astrelion/Projects/dungeons-bot/.venv/lib/python3.13/site-packages/mastodon/streaming_endpoints.py", line 20, in stream_user
return self.__stream('/api/v1/streaming/user', listener, run_async=run_async, timeout=timeout, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/astrelion/Projects/dungeons-bot/.venv/lib/python3.13/site-packages/mastodon/internals.py", line 523, in __stream
listener.handle_stream(r)
~~~~~~~~~~~~~~~~~~~~~~^^^
File "/home/astrelion/Projects/dungeons-bot/.venv/lib/python3.13/site-packages/mastodon/streaming.py", line 148, in handle_stream
self._dispatch(event)
~~~~~~~~~~~~~~^^^^^^^
File "/home/astrelion/Projects/dungeons-bot/.venv/lib/python3.13/site-packages/mastodon/streaming.py", line 203, in _dispatch
raise exception from err
mastodon.errors.MastodonMalformedEventError: ('Missing field', 'event', {})
This is the line where the error occurs: https://github.com/halcy/Mastodon.py/blob/master/mastodon/streaming.py#L189
I did a little bit of debugging and it seems that I'm getting periodic :thump events that can't be parsed by this event handler.
Is there something I'm doing wrong that causes getting those malformed events, or is it an issue with the library?
Mastodon.py version: tested on 2.1.4 and 1.8
Python: 3.13.11
Metadata
Metadata
Assignees
Labels
No labels