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

View File

@ -13,16 +13,16 @@ async def get_author(author_id):
"operation": "GetAuthorById", "operation": "GetAuthorById",
"variables": {"author_id": author_id} "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)) response = await client.post(API_BASE, headers=headers, data=json.dumps(gql))
print(f"[services.core] get_author response: {response.status_code} {response.text}") print(f"[services.core] get_author response: {response.status_code} {response.text}")
if response.status_code != 200: if response.status_code != 200:
return None return None
r = response.json() r = response.json()
print(f"[services.core] got author: {r}") author = r.get("data", {}).get("getAuthorById")
author = r.get("data", {}).get("getAuthorbyId")
return author return author
except Exception: except Exception:
return None return None