core-service-connector-fix

This commit is contained in:
2023-10-12 15:15:06 +03:00
parent 85fc48b3c8
commit f6ef50f878
3 changed files with 16 additions and 11 deletions

View File

@@ -9,10 +9,9 @@ headers = {"Content-Type": "application/json"}
async def get_author(author_id):
gql = {
"query": "query GetAuthor { getAuthor(author_id: %s) { id slug userpic name lastSeen } }"
% author_id,
"query": "query GetAuthor { getAuthor(author_id: Int!) { id slug userpic name lastSeen } }",
"operation": "GetAuthor",
"variables": None
"variables": { "author_id" : author_id }
}
try:
async with AsyncClient() as client:
@@ -28,10 +27,13 @@ async def get_author(author_id):
async def get_network(author_id, limit=50, offset=0) -> list:
gql = {
"query": "query LoadAuthors { authorFollowings(author_id: %s, limit: %s, offset: %s) { id slug userpic name } }"
% (author_id, limit, offset),
"query": "query LoadAuthors { authorFollowings(author_id: Int!, limit: Int, offset: Int) { id slug userpic name } }",
"operation": "LoadAuthors",
"variables": None
"variables": {
"author_id": author_id,
"limit": limit,
"offset": offset
}
}
followings = []
@@ -56,10 +58,12 @@ async def get_network(author_id, limit=50, offset=0) -> list:
async def get_followers(author_id, amount):
gql = {
"query": "query LoadAuthors { authorFollowers(author_id: %s, limit: %s) { id slug userpic name } }"
% (author_id, amount),
"query": "query LoadAuthors { authorFollowers(author_id: Int!, limit: Int) { id slug userpic name } }",
"operation": "LoadAuthors",
"variables": None
"variables": {
"author_id": author_id,
"limit": amount
}
}
followers = []
try: