Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login by session id (to import) #63

Merged
merged 1 commit into from
Oct 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions routers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
responses={404: {"description": "Not found"}}
)


@router.post("/login")
async def auth_login(username: str = Form(...),
password: str = Form(...),
Expand Down Expand Up @@ -40,6 +41,19 @@ async def auth_login(username: str = Form(...),
return result


@router.post("/login_by_sessionid")
async def auth_login_by_sessionid(sessionid: str = Form(...),
clients: ClientStorage = Depends(get_clients)) -> str:
"""Login by sessionid
"""
cl = clients.client()
result = cl.login_by_sessionid(sessionid)
if result:
clients.set(cl)
return cl.sessionid
return result


@router.post("/relogin")
async def auth_relogin(sessionid: str = Form(...),
clients: ClientStorage = Depends(get_clients)) -> str:
Expand All @@ -52,7 +66,7 @@ async def auth_relogin(sessionid: str = Form(...),

@router.get("/settings/get")
async def settings_get(sessionid: str,
clients: ClientStorage = Depends(get_clients)) -> Dict:
clients: ClientStorage = Depends(get_clients)) -> Dict:
"""Get client's settings
"""
cl = clients.get(sessionid)
Expand All @@ -74,9 +88,10 @@ async def settings_set(settings: str = Form(...),
clients.set(cl)
return cl.sessionid


@router.get("/timeline_feed")
async def timeline_feed(sessionid: str,
clients: ClientStorage = Depends(get_clients)) -> Dict:
clients: ClientStorage = Depends(get_clients)) -> Dict:
"""Get your timeline feed
"""
cl = clients.get(sessionid)
Expand Down
Loading