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