forked from claw/flaskpaste
routes: fix ruff formatting
This commit is contained in:
@@ -1053,9 +1053,7 @@ class IndexView(MethodView):
|
|||||||
g.rate_limit_reset = reset_timestamp
|
g.rate_limit_reset = reset_timestamp
|
||||||
|
|
||||||
if not allowed:
|
if not allowed:
|
||||||
current_app.logger.warning(
|
current_app.logger.warning("Rate limit exceeded: ip=%s", client_ip)
|
||||||
"Rate limit exceeded: ip=%s", client_ip
|
|
||||||
)
|
|
||||||
# Audit log rate limit event
|
# Audit log rate limit event
|
||||||
if current_app.config.get("AUDIT_ENABLED", True):
|
if current_app.config.get("AUDIT_ENABLED", True):
|
||||||
from app.audit import AuditEvent, AuditOutcome, log_event
|
from app.audit import AuditEvent, AuditOutcome, log_event
|
||||||
@@ -2007,9 +2005,7 @@ class ShortURLCreateView(MethodView):
|
|||||||
if not allowed:
|
if not allowed:
|
||||||
record_rate_limit("blocked")
|
record_rate_limit("blocked")
|
||||||
retry_after = max(1, reset_timestamp - int(time.time()))
|
retry_after = max(1, reset_timestamp - int(time.time()))
|
||||||
response = error_response(
|
response = error_response("Rate limit exceeded", 429, retry_after=retry_after)
|
||||||
"Rate limit exceeded", 429, retry_after=retry_after
|
|
||||||
)
|
|
||||||
response.headers["Retry-After"] = str(retry_after)
|
response.headers["Retry-After"] = str(retry_after)
|
||||||
add_rate_limit_headers(response, 0, limit, reset_timestamp)
|
add_rate_limit_headers(response, 0, limit, reset_timestamp)
|
||||||
return response
|
return response
|
||||||
|
|||||||
Reference in New Issue
Block a user