Spaces:
Sleeping
Sleeping
Download middleware.py from eishit32/UPNISO_API: direct link, hf CLI and curl.
- Browser
- Download file 226 Bytes
-
https://huggingface.co/spaces/eishit32/UPNISO_API/resolve/main/middleware.py
- Command line
-
hf download hf://spaces/eishit32/UPNISO_API/middleware.py
-
curl -L -o middleware.py https://huggingface.co/spaces/eishit32/UPNISO_API/resolve/main/middleware.py
226 Bytes
| from fastapi import Request, HTTPException | |
| async def api_guard(request: Request, call_next): | |
| if "x-api-key" not in request.headers: | |
| raise HTTPException(401, "API key required") | |
| return await call_next(request) | |