Download backend/api/auth.py from ZAIDX11/Axiovora-X: direct link, hf CLI and curl.
- Browser
- Download file 477 Bytes
-
https://huggingface.co/ZAIDX11/Axiovora-X/resolve/main/backend/api/auth.py
- Command line
-
hf download hf://ZAIDX11/Axiovora-X/backend/api/auth.py
-
curl -L -o auth.py https://huggingface.co/ZAIDX11/Axiovora-X/resolve/main/backend/api/auth.py
477 Bytes
| from fastapi import Depends, HTTPException, status | |
| from fastapi.security import APIKeyHeader | |
| API_KEY = "your_api_key_here" # Replace with a secure key or load from env | |
| api_key_header = APIKeyHeader(name="X-API-Key") | |
| def get_api_key(api_key: str = Depends(api_key_header)): | |
| if api_key != API_KEY: | |
| raise HTTPException( | |
| status_code=status.HTTP_401_UNAUTHORIZED, | |
| detail="Invalid or missing API Key", | |
| ) | |
| return api_key | |