Spaces:
Running
Running
Download app/core/security.py from fallingbody/Mockai: direct link, hf CLI and curl.
- Browser
- Download file 542 Bytes
-
https://huggingface.co/spaces/fallingbody/Mockai/resolve/main/app/core/security.py
- Command line
-
hf download hf://spaces/fallingbody/Mockai/app/core/security.py
-
curl -L -o security.py https://huggingface.co/spaces/fallingbody/Mockai/resolve/main/app/core/security.py
542 Bytes
| from flask import request | |
| from app.core.exceptions import AuthenticationError | |
| from app.core.logger import get_logger | |
| from app.core.config import settings | |
| logger = get_logger(__name__) | |
| def verify_api_key(): | |
| api_key = request.headers.get("X-API-KEY") | |
| if not api_key: | |
| raise AuthenticationError("API key missing") | |
| if api_key != settings.API_KEY: | |
| raise AuthenticationError("Invalid API key") | |
| def rate_limit(): | |
| """ | |
| Hook for future Redis-based rate limiting. | |
| Intentionally minimal. | |
| """ | |
| return | |