Update server.py
Browse files
server.py
CHANGED
@@ -428,12 +428,12 @@ def before_request():
|
|
428 |
try:
|
429 |
if request.method != 'OPTIONS' and is_authorize_ignored(request) == False and getattr(request.authorization, 'token', '') != api_key:
|
430 |
print(f"WARNING: Unauthorized API key access from {request.remote_addr}")
|
431 |
-
response =
|
432 |
response.status_code = 401
|
433 |
-
return
|
434 |
except Exception as e:
|
435 |
print(f"API key check error: {e}")
|
436 |
-
return "this space is only for doctord98
|
437 |
|
438 |
|
439 |
@app.after_request
|
|
|
428 |
try:
|
429 |
if request.method != 'OPTIONS' and is_authorize_ignored(request) == False and getattr(request.authorization, 'token', '') != api_key:
|
430 |
print(f"WARNING: Unauthorized API key access from {request.remote_addr}")
|
431 |
+
response = jsonify({ 'error': '401: Invalid API key' })
|
432 |
response.status_code = 401
|
433 |
+
return "this space is only for doctord98 but you can duplicate it and enjoy"
|
434 |
except Exception as e:
|
435 |
print(f"API key check error: {e}")
|
436 |
+
return "this space is only for doctord98 but you can duplicate it and enjoy"
|
437 |
|
438 |
|
439 |
@app.after_request
|