feat: draw the rest of the owl
This commit is contained in:
parent
e21b725192
commit
2ba848467f
28 changed files with 1538 additions and 448 deletions
20
src/security.py
Normal file
20
src/security.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
from typing import Annotated
|
||||
|
||||
from fastapi import Depends, Header, HTTPException
|
||||
from starlette import status
|
||||
|
||||
from src.config import settings
|
||||
|
||||
|
||||
def api_key(host: str = Header(), authorization: str | None = Header(None)) -> bool:
|
||||
if host.lower().strip() != settings.API_DOMAIN.strip():
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND)
|
||||
try:
|
||||
if authorization.split()[1] == settings.API_KEY:
|
||||
return True
|
||||
return False
|
||||
except AttributeError, TypeError, IndexError:
|
||||
return False
|
||||
|
||||
|
||||
ApiKey = Annotated[bool, Depends(api_key)]
|
||||
Loading…
Add table
Add a link
Reference in a new issue