This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
from typing import List
|
||||
|
||||
from typing import List, Any
|
||||
from httpx import AsyncClient
|
||||
|
||||
from orm.author import Author
|
||||
from orm.shout import Shout
|
||||
from settings import API_BASE
|
||||
|
||||
headers = {"Content-Type": "application/json"}
|
||||
@@ -27,22 +23,7 @@ async def _request_endpoint(query_name, body):
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
async def get_author(author_id) -> Author:
|
||||
query_name = "get_author"
|
||||
query_type = "query"
|
||||
operation = "GetAuthor"
|
||||
query_fields = "id slug pic name"
|
||||
|
||||
gql = {
|
||||
"query": query_type + " " + operation + " { " + query_name + " { " + query_fields + "} " + " }",
|
||||
"operationName": operation,
|
||||
"variables": None,
|
||||
}
|
||||
|
||||
return await _request_endpoint(query_name, gql)
|
||||
|
||||
|
||||
async def get_followed_shouts(author_id: int) -> List[Shout]:
|
||||
async def get_followed_shouts(author_id: int) -> List[Any]:
|
||||
query_name = "load_shouts_followed"
|
||||
query_type = "query"
|
||||
operation = "GetFollowedShouts"
|
||||
@@ -55,7 +36,7 @@ async def get_followed_shouts(author_id: int) -> List[Shout]:
|
||||
body = {
|
||||
"query": query,
|
||||
"operationName": operation,
|
||||
"variables": {"author_id": author_id, "limit": 1000, "offset": 0}, # FIXME: too big
|
||||
"variables": {"author_id": author_id, "limit": 1000, "offset": 0}, # FIXME: too big limit
|
||||
}
|
||||
|
||||
return await _request_endpoint(query_name, body)
|
||||
|
Reference in New Issue
Block a user