controller.py
Код: Выделить всё
router = APIRouter(
prefix="/v2/test",
tags=["helloWorld"],
dependencies=[Depends(api_key)],
responses={404: {"description": "Not found"}},
Authorzation.py
Код: Выделить всё
async def api_key(api_key_header: str = Security(api_key_header_auth)):
if api_key_header != API_KEY:
raise HTTPException(
status_code=401,
detail="Invalid API Key",
)
Подробнее здесь: https://stackoverflow.com/questions/761 ... nvironment
Мобильная версия