Files
boc/landvex-paket/api/auth.py
T
Bernt 6de2455917 v1.2.0: Add Global Markets footer, translated to 9 languages
- Added GLOBAL_MARKETS_TITLE to all translation files
- Updated footer with 12 markets (4 active + 8 upcoming)
- Translated market section to: zh-cn, zh-tw, ja, ko, th, vi, id, ms, hi
- Built and deployed to production
- CloudFront invalidation: I3RTMXVFDJXWLG3SYX208OP1CC
2026-07-08 19:56:03 +00:00

24 lines
678 B
Python

"""
Enkel API-nyckel autentisering för LandveX API
"""
from fastapi import HTTPException, Header
from typing import Optional
# Demo-nycklar (i produktion: lagra säkert!)
API_KEYS = {
"demo-key-2026": {"plan": "pilot", "rate_limit": 1000},
"pro-key-2026": {"plan": "pro", "rate_limit": 10000},
}
def verify_api_key(x_api_key: Optional[str] = Header(None)):
"""Verifiera API-nyckel från header."""
if not x_api_key:
raise HTTPException(status_code=401, detail="API-nyckel saknas. Skicka X-API-Key header.")
if x_api_key not in API_KEYS:
raise HTTPException(status_code=403, detail="Ogiltig API-nyckel.")
return API_KEYS[x_api_key]