Skip to content

Commit ecadf07

Browse files
committed
fix: type check errors
1 parent 1ec5d62 commit ecadf07

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/webapp/main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Main file for the SST API."""
22

33
import logging
4-
from typing import Any, Annotated
4+
from typing import Any, Annotated, Optional, cast
55
from datetime import timedelta
66
import secrets
77
from fastapi import FastAPI, Depends, HTTPException, status, Security
@@ -96,7 +96,9 @@ def read_root() -> Any:
9696
@app.post("/token-from-api-key")
9797
async def access_token_from_api_key(
9898
sql_session: Annotated[Session, Depends(get_session)],
99-
api_key_enduser_tuple: str = Security(get_api_key),
99+
api_key_enduser_tuple: tuple[str, Optional[str], Optional[str]] = Security(
100+
get_api_key
101+
),
100102
) -> Token:
101103
"""Generate a token from an API key."""
102104
local_session.set(sql_session)
@@ -111,7 +113,7 @@ async def access_token_from_api_key(
111113
)
112114

113115
access_token_expires = timedelta(
114-
minutes=int(env_vars["ACCESS_TOKEN_EXPIRE_MINUTES"])
116+
minutes=int(cast(str, env_vars["ACCESS_TOKEN_EXPIRE_MINUTES"]))
115117
)
116118
access_token = create_access_token(
117119
data={"sub": user.email}, expires_delta=access_token_expires

0 commit comments

Comments
 (0)