Linted with black

This commit is contained in:
YOGESHWARAN R 2021-05-18 09:11:02 +05:30
parent 167f551a96
commit 202db95f52
No known key found for this signature in database
GPG key ID: A43D3BDEF049D20D
10 changed files with 325 additions and 168 deletions

View file

@ -7,11 +7,13 @@ banned = {}
active = False
threshold = -1
def clear_banned():
global banned
banned = {}
def setup(violations_threshold = 100):
def setup(violations_threshold=100):
global active
global threshold
@ -31,6 +33,7 @@ def report(request_ip):
banned[request_ip] = banned.get(request_ip, 0)
banned[request_ip] += 1
def is_banned(request_ip):
# More than X offences?
return active and banned.get(request_ip, 0) >= threshold