File size: 385 Bytes
5e1dfdc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
from fastapi import FastAPI, HTTPException
app = FastAPI()
LICENSE_KEYS = {
"abc-basic": "basic",
"xyz-pro": "pro",
"ent-999": "enterprise"
}
@app.post("/validate")
def validate_license(data: dict):
key = data.get("key")
if key not in LICENSE_KEYS:
raise HTTPException(status_code=403, detail="Invalid license key")
return {"tier": LICENSE_KEYS[key]}
|