Spaces:
Sleeping
Sleeping
File size: 363 Bytes
430f6e8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
from fastapi import HTTPException, Security
from fastapi.security import api_key
api_key_header = api_key.APIKeyHeader(name="X-API-KEY")
async def validate_api_key(key: str = Security(api_key_header)):
if key != settings.API_KEY:
raise HTTPException(
status_code=401, detail="Unauthorized - API Key is wrong"
)
return None
|