some-more-fixes
This commit is contained in:
parent
8c87457a09
commit
85fc48b3c8
|
@ -44,7 +44,9 @@ async def update_chat(_, info, chat_new):
|
|||
|
||||
@mutation.field("createChat")
|
||||
@login_required
|
||||
async def create_chat(_, info, title="", members=[]):
|
||||
async def create_chat(_, info, title="", members=None):
|
||||
if members is None:
|
||||
members = []
|
||||
chat = None
|
||||
author_id = info.context["author_id"]
|
||||
print("create_chat members: %r" % members)
|
||||
|
|
|
@ -26,7 +26,7 @@ async def get_author(author_id):
|
|||
return None
|
||||
|
||||
|
||||
async def get_network(author_id, limit=50, offset=0):
|
||||
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),
|
||||
|
@ -40,7 +40,7 @@ async def get_network(author_id, limit=50, offset=0):
|
|||
async with AsyncClient() as client:
|
||||
response = await client.post(API_BASE, headers=headers, data=json.dumps(gql))
|
||||
if response.status_code != 200:
|
||||
return False, None
|
||||
return []
|
||||
r = response.json()
|
||||
followings = r.get("data", {}).get("authorFollowings", [])
|
||||
more_amount = limit - len(followings)
|
||||
|
@ -49,7 +49,9 @@ async def get_network(author_id, limit=50, offset=0):
|
|||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
return followings + followers
|
||||
followings.extend(followers)
|
||||
|
||||
return followings
|
||||
|
||||
|
||||
async def get_followers(author_id, amount):
|
||||
|
@ -64,7 +66,7 @@ async def get_followers(author_id, amount):
|
|||
async with AsyncClient() as client:
|
||||
response = await client.post(API_BASE, headers=headers, data=json.dumps(gql))
|
||||
if response.status_code != 200:
|
||||
return False, None
|
||||
return []
|
||||
r = response.json()
|
||||
followers = r.get("data", {}).get("authorFollowers", [])
|
||||
except Exception as e:
|
||||
|
|
Loading…
Reference in New Issue
Block a user