Change _asdict() to dict()

This commit is contained in:
Tiago vasconcelos 2022-01-05 09:48:26 +00:00 committed by fiatjaf
parent aba206c87e
commit a00e46f629
4 changed files with 5 additions and 5 deletions

View File

@ -50,7 +50,7 @@ async def dispatch_invoice_listener(payment: Payment):
async def dispatch_webhook(payment: Payment):
async with httpx.AsyncClient() as client:
data = payment._asdict()
data = payment.dict()
try:
r = await client.post(payment.webhook, json=data, timeout=40)
await mark_webhook_sent(payment, r.status_code)

View File

@ -66,7 +66,7 @@ async def api_link_retrieve(
detail="Not your pay link.", status_code=HTTPStatus.FORBIDDEN
)
return {**link._asdict(), **{"lnurl": link.lnurl(r)}}
return {**link.dict(), **{"lnurl": link.lnurl(r)}}
@lnurlp_ext.post("/api/v1/links", status_code=HTTPStatus.CREATED)

View File

@ -173,7 +173,7 @@ async def api_get_donations(g: WalletTypeInfo = Depends(get_key_type)):
for wallet_id in wallet_ids:
new_donations = await get_donations(wallet_id)
donations += new_donations if new_donations else []
return [donation._asdict() for donation in donations] if donations else []
return [donation.dict() for donation in donations] if donations else []
@streamalerts_ext.put("/api/v1/donations/{donation_id}")

View File

@ -92,7 +92,7 @@ async def api_get_tipjars(wallet: WalletTypeInfo = Depends(get_key_type)):
for wallet_id in wallet_ids:
new_tipjars = await get_tipjars(wallet_id)
tipjars += new_tipjars if new_tipjars else []
return [tipjar._asdict() for tipjar in tipjars] if tipjars else []
return [tipjar.dict() for tipjar in tipjars] if tipjars else []
@tipjar_ext.get("/api/v1/tips")
@ -103,7 +103,7 @@ async def api_get_tips(wallet: WalletTypeInfo = Depends(get_key_type)):
for wallet_id in wallet_ids:
new_tips = await get_tips(wallet_id)
tips += new_tips if new_tips else []
return [tip._asdict() for tip in tips] if tips else []
return [tip.dict() for tip in tips] if tips else []
@tipjar_ext.put("/api/v1/tips/{tip_id}")