mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-24 22:58:46 +01:00
switched requests for httpx
This commit is contained in:
parent
ca60893701
commit
9c8836096c
2 changed files with 9 additions and 3 deletions
|
@ -20,7 +20,7 @@ from embit import script
|
||||||
from embit import ec
|
from embit import ec
|
||||||
from embit.networks import NETWORKS
|
from embit.networks import NETWORKS
|
||||||
from binascii import unhexlify, hexlify, a2b_base64, b2a_base64
|
from binascii import unhexlify, hexlify, a2b_base64, b2a_base64
|
||||||
import requests
|
import httpx
|
||||||
|
|
||||||
|
|
||||||
async def get_derive_address(wallet_id: str, num: int):
|
async def get_derive_address(wallet_id: str, num: int):
|
||||||
|
@ -122,7 +122,13 @@ async def delete_charge(charge_id: str) -> None:
|
||||||
async def check_address_balance(address: str) -> List[Charges]:
|
async def check_address_balance(address: str) -> List[Charges]:
|
||||||
address_data = await get_address(address)
|
address_data = await get_address(address)
|
||||||
mempool = await get_mempool(address_data.user)
|
mempool = await get_mempool(address_data.user)
|
||||||
r = requests.get(mempool.endpoint + "/api/address/" + address)
|
|
||||||
|
try:
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
r = await client.get(mempool.endpoint + "/api/address/" + address)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
amount_paid = r.json()['chain_stats']['funded_txo_sum'] - r.json()['chain_stats']['spent_txo_sum']
|
amount_paid = r.json()['chain_stats']['funded_txo_sum'] - r.json()['chain_stats']['spent_txo_sum']
|
||||||
print(amount_paid)
|
print(amount_paid)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import hashlib
|
import hashlib
|
||||||
from quart import g, jsonify, request, url_for
|
from quart import g, jsonify, url_for
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue