From faa877cb87fef215b41cd9d351221044147f009a Mon Sep 17 00:00:00 2001 From: pre-commit Date: Wed, 11 Sep 2024 12:12:41 +0000 Subject: [PATCH] pre-commit fixes --- app/api/api_v1/routers/session.py | 15 ++++++++++----- app/main.py | 4 +--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/api/api_v1/routers/session.py b/app/api/api_v1/routers/session.py index e9b4447..7ae8e48 100644 --- a/app/api/api_v1/routers/session.py +++ b/app/api/api_v1/routers/session.py @@ -1,7 +1,8 @@ +from typing import Optional + +import httpx from fastapi import APIRouter, Header, HTTPException from fastapi.responses import JSONResponse -import httpx -from typing import Optional session_router = router = APIRouter() @@ -9,15 +10,19 @@ @router.get("/whoami") async def get_session(authorization: Optional[str] = Header(None)): if not authorization: - raise HTTPException(status_code=401, detail="Authorization header is missing") + raise HTTPException( + status_code=401, detail="Authorization header is missing" + ) async with httpx.AsyncClient() as client: response = await client.get( "https://develop-xtjn2g.zitadel.cloud/oidc/v1/userinfo", - headers={"Authorization": authorization} + headers={"Authorization": authorization}, ) if response.status_code == 200: return JSONResponse(content=response.json(), status_code=200) else: - raise HTTPException(status_code=401, detail="Invalid or expired session") \ No newline at end of file + raise HTTPException( + status_code=401, detail="Invalid or expired session" + ) diff --git a/app/main.py b/app/main.py index acf19c9..4b96055 100644 --- a/app/main.py +++ b/app/main.py @@ -38,6 +38,4 @@ async def home(request: Request): app.include_router( dictionary_router, prefix="/dictionary", tags=["Dictionary"] ) -app.include_router( - session_router, prefix="/session", tags=[] -) +app.include_router(session_router, prefix="/session", tags=[])