This commit is contained in:
Untone 2023-10-13 16:35:16 +03:00
parent ca607a9b9e
commit 806fb5f6f7

View File

@ -13,18 +13,18 @@ async def get_author(author_id):
"operation": "GetAuthorById",
"variables": {"author_id": author_id}
}
try:
async with AsyncClient() as client:
async with AsyncClient() as client:
try:
response = await client.post(API_BASE, headers=headers, data=json.dumps(gql))
print(f"[services.core] get_author response: {response.status_code} {response.text}")
if response.status_code != 200:
return None
r = response.json()
print(f"[services.core] got author: {r}")
author = r.get("data", {}).get("getAuthorbyId")
author = r.get("data", {}).get("getAuthorById")
return author
except Exception:
return None
except Exception:
return None
async def get_network(author_id:int, limit:int = 50, offset:int = 0) -> list: