mirror of
https://github.com/lnbits/lnbits.git
synced 2025-07-12 14:02:37 +02:00
fix: rename variable
This commit is contained in:
@ -153,20 +153,20 @@ class LNbitsWallet(Wallet):
|
||||
async with client.stream(
|
||||
"GET", url, content="text/event-stream"
|
||||
) as r:
|
||||
sse_event = False
|
||||
sse_trigger = False
|
||||
async for line in r.aiter_lines():
|
||||
# The data we want to listen to is of this shape:
|
||||
# event: payment-received
|
||||
# data: {.., "payment_hash" : "asd"}
|
||||
if line.startswith("event: payment-received"):
|
||||
sse_event = True
|
||||
sse_trigger = True
|
||||
continue
|
||||
elif sse_event and line.startswith("data:"):
|
||||
elif sse_trigger and line.startswith("data:"):
|
||||
data = json.loads(line[len("data:") :])
|
||||
sse_event = False
|
||||
sse_trigger = False
|
||||
yield data["payment_hash"]
|
||||
else:
|
||||
sse_event = False
|
||||
sse_trigger = False
|
||||
|
||||
except (OSError, httpx.ReadError, httpx.ConnectError, httpx.ReadTimeout):
|
||||
pass
|
||||
|
Reference in New Issue
Block a user