b
This commit is contained in:
parent
ca607a9b9e
commit
806fb5f6f7
|
@ -13,18 +13,18 @@ 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:
|
|
||||||
return None
|
except Exception:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
async def get_network(author_id:int, limit:int = 50, offset:int = 0) -> list:
|
async def get_network(author_id:int, limit:int = 50, offset:int = 0) -> list:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user