Spaces:
Running
Running
File size: 440 Bytes
06bd65a | 1 2 3 4 5 6 7 8 9 10 11 12 | from fastapi import Header, HTTPException, status
from src.config import settings
async def verify_api_key(x_api_key: str = Header(...)):
"""Validates the client's API Key against settings to prevent unauthorized usage."""
if x_api_key != settings.API_KEY:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Invalid or missing API key."
)
return x_api_key
|