1
0
Fork 0

Print every received event in debug mode

This commit is contained in:
Casey 2023-07-03 17:03:20 +03:00
parent 8d91d619dd
commit 2ddb2639bf
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 1 additions and 1 deletions

View File

@ -34,13 +34,13 @@ async def websocket_source(
async with connect(url) as ws: async with connect(url) as ws:
while (msg := await ws.recv()) is not None: while (msg := await ws.recv()) is not None:
event = loads(msg) event = loads(msg)
logger.debug("data: %r", event)
if "error" in event: if "error" in event:
raise Exception(event["error"]) raise Exception(event["error"])
if event["event"] == "update": if event["event"] == "update":
yield Status.from_dict(loads(event["payload"])) yield Status.from_dict(loads(event["payload"]))
else: else:
logger.warn("unknown event type %r", event["event"]) logger.warn("unknown event type %r", event["event"])
logger.debug("data: %r", event)
except ( except (
WebSocketException, WebSocketException,
TimeoutError, TimeoutError,