Spaces:
Runtime error
Runtime error
Download core/security.py from KevsOno/Kevs_Digital_Business_Intelligence: direct link, hf CLI and curl.
- Browser
- Download file 314 Bytes
-
https://huggingface.co/spaces/KevsOno/Kevs_Digital_Business_Intelligence/resolve/main/core/security.py
- Command line
-
hf download hf://spaces/KevsOno/Kevs_Digital_Business_Intelligence/core/security.py
-
curl -L -o security.py https://huggingface.co/spaces/KevsOno/Kevs_Digital_Business_Intelligence/resolve/main/core/security.py
314 Bytes
| # app/core/security.py | |
| from fastapi import Header, HTTPException | |
| import os | |
| API_SECRET_KEY = os.getenv("API_SECRET_KEY") | |
| def verify_api_key(x_api_key: str = Header(None)): | |
| if not x_api_key or x_api_key != API_SECRET_KEY: | |
| raise HTTPException(status_code=401, detail="Invalid API key") | |
| return True |