Download api/auth.py from Rfym21/bb2api: direct link, hf CLI and curl.
- Browser
- Download file 424 Bytes
-
https://huggingface.co/spaces/Rfym21/bb2api/resolve/main/api/auth.py
- Command line
-
hf download hf://spaces/Rfym21/bb2api/api/auth.py
-
curl -L -o auth.py https://huggingface.co/spaces/Rfym21/bb2api/resolve/main/api/auth.py
424 Bytes
| from fastapi import Depends, HTTPException | |
| from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer | |
| from api.config import APP_SECRET | |
| security = HTTPBearer() | |
| def verify_app_secret(credentials: HTTPAuthorizationCredentials = Depends(security)): | |
| if credentials.credentials != APP_SECRET: | |
| raise HTTPException(status_code=403, detail="Invalid APP_SECRET") | |
| return credentials.credentials | |