Skip to content

Commit

Permalink
Print every received event in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
hatkidchan committed Jul 3, 2023
1 parent 8d91d61 commit 2ddb263
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mastoposter/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ async def websocket_source(
async with connect(url) as ws:
while (msg := await ws.recv()) is not None:
event = loads(msg)
logger.debug("data: %r", event)
if "error" in event:
raise Exception(event["error"])
if event["event"] == "update":
yield Status.from_dict(loads(event["payload"]))
else:
logger.warn("unknown event type %r", event["event"])
logger.debug("data: %r", event)
except (
WebSocketException,
TimeoutError,
Expand Down

0 comments on commit 2ddb263

Please sign in to comment.