core-graphql-fix

This commit is contained in:
Untone 2023-10-13 14:09:15 +03:00
parent 2e1a9e2ffd
commit efa3ecb174

View File

@ -9,8 +9,8 @@ headers = {"Content-Type": "application/json"}
async def get_author(author_id):
gql = {
"query": "query GetAuthor { getAuthor(author_id: Int!) { id slug userpic name lastSeen } }",
"operation": "GetAuthor",
"query": "query GetAuthorById { getAuthorById(author_id: Int!) { id slug userpic name lastSeen } }",
"operation": "GetAuthorById",
"variables": {"author_id": author_id}
}
try:
@ -20,7 +20,7 @@ async def get_author(author_id):
return None
r = response.json()
print(f"[services.core] got author: {r}")
author = r.get("data", {}).get("getAuthor")
author = r.get("data", {}).get("getAuthorbyId")
return author
except Exception:
return None