Debian Codegraph @

docs_src/bigger_applications/app_an_py310/dependencies.py

raw
1 from typing import Annotated
2
3 from fastapi import Header, HTTPException
4
5
6 async def get_token_header(x_token: Annotated[str, Header()]):
7 if x_token != "fake-super-secret-token":
8 raise HTTPException(status_code=400, detail="X-Token header invalid")
9
10
11 async def get_query_token(token: str):
12 if token != "jessica":
13 raise HTTPException(status_code=400, detail="No Jessica token provided")