no-datetime-scalar

This commit is contained in:
2023-10-14 18:11:17 +03:00
parent 34dd4ec140
commit 4e44e2f39e
4 changed files with 14 additions and 13 deletions

View File

@@ -1,3 +1,5 @@
from datetime import datetime
from httpx import AsyncClient
from settings import API_BASE
@@ -22,8 +24,14 @@ async def get_author(author_id):
if response.status_code != 200:
return None
r = response.json()
author: ChatMember | None = r.get("data", {}).get("getAuthorById")
return author
a = r.get("data", {}).get("getAuthorById")
if a:
last_seen = a.get("lastSeen")
dt = datetime.strptime(last_seen, "%Y-%m-%dT%H:%M:%S.%f")
timestamp = int(dt.timestamp())
a["lastSeen"] = timestamp
author: ChatMember = a
return author
async def get_network(author_id: int, limit: int = 50, offset: int = 0) -> list: