Skip to content

Commit

Permalink
Merge pull request #63 from NathanFallet/main
Browse files Browse the repository at this point in the history
Login by session id (to import)
  • Loading branch information
subzeroid authored Oct 29, 2023
2 parents e7c3105 + e7ca986 commit 383e7cd
Showing 1 changed file with 17 additions and 2 deletions.
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

0 comments on commit 383e7cd

Please sign in to comment.