Print every received event in debug mode
This commit is contained in:
parent
8d91d619dd
commit
2ddb2639bf
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue