migrate from aiohttp to httpx following master.

This commit is contained in:
fiatjaf
2020-10-04 12:04:59 -03:00
parent 2c92205703
commit bbe8d05af4
3 changed files with 20 additions and 24 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
import json
import asyncio
import aiohttp
import httpx
from os import getenv
from http import HTTPStatus
from typing import Optional, Dict, AsyncGenerator
@@ -93,12 +93,12 @@ class LNPayWallet(Wallet):
return "", HTTPStatus.NO_CONTENT
lntx_id = data["data"]["wtx"]["lnTx"]["id"]
async with aiohttp.ClientSession() as session:
resp = await session.get(
async with httpx.AsyncClient() as client:
r = await client.get(
f"{self.endpoint}/user/lntx/{lntx_id}?fields=settled",
headers=self.auth_api,
)
data = await resp.json()
data = r.json()
if data["settled"]:
self.queue.put_nowait(lntx_id)