no-datetime-scalar
This commit is contained in:
@@ -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:
|
||||
|
Reference in New Issue
Block a user