fix: increment bad requests when trying to access authed endpoint
without a token
This commit is contained in:
@@ -20,6 +20,7 @@ def require_authentication(func):
|
|||||||
except:
|
except:
|
||||||
raise AssertionError(f"Function \"{func.__name__}\" does not return status, code, and data as it should!")
|
raise AssertionError(f"Function \"{func.__name__}\" does not return status, code, and data as it should!")
|
||||||
else:
|
else:
|
||||||
|
increment_bad_requests()
|
||||||
return 401, "error", {'error_msg': "Unauthorized"}
|
return 401, "error", {'error_msg': "Unauthorized"}
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
@@ -33,7 +34,7 @@ def not_implemented(data):
|
|||||||
def stub_hello():
|
def stub_hello():
|
||||||
return 200, 'hello from v1! stats are at /api/v1/stats', []
|
return 200, 'hello from v1! stats are at /api/v1/stats', []
|
||||||
|
|
||||||
def epochToDate(epoch):
|
def epoch_to_date(epoch):
|
||||||
return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(epoch))
|
return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(epoch))
|
||||||
|
|
||||||
def stats():
|
def stats():
|
||||||
@@ -53,7 +54,7 @@ def get_matches():
|
|||||||
|
|
||||||
@require_authentication
|
@require_authentication
|
||||||
def debugger_halt(r):
|
def debugger_halt(r):
|
||||||
print(f"{c.WARNING}[{epochToDate(time.time())}]{c.ENDC} {r.remote_addr} triggered a debugger halt!")
|
print(f"{c.WARNING}[{epoch_to_date(time.time())}]{c.ENDC} {r.remote_addr} triggered a debugger halt!")
|
||||||
breakpoint()
|
breakpoint()
|
||||||
return 200, "ok", []
|
return 200, "ok", []
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user