Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
7e31555
1
Parent(s):
f73ccd7
try fixing valid key issue
Browse files
main.py
CHANGED
@@ -23,7 +23,7 @@ VALID_API_KEYS = os.environ.get("api_key")
|
|
23 |
@app.middleware("http")
|
24 |
async def verify_api_key(request, call_next):
|
25 |
api_key = request.headers.get("x-api-key")
|
26 |
-
if api_key not in VALID_API_KEYS:
|
27 |
raise HTTPException(status_code=403, detail="Unauthorized")
|
28 |
response = await call_next(request)
|
29 |
return response
|
|
|
23 |
@app.middleware("http")
|
24 |
async def verify_api_key(request, call_next):
|
25 |
api_key = request.headers.get("x-api-key")
|
26 |
+
if api_key is None or api_key not in VALID_API_KEYS:
|
27 |
raise HTTPException(status_code=403, detail="Unauthorized")
|
28 |
response = await call_next(request)
|
29 |
return response
|