Skip to content

Commit

Permalink
Cleanup (#1428)
Browse files Browse the repository at this point in the history
  • Loading branch information
charmander authored Sep 10, 2024
2 parents f6aa843 + ee364f8 commit f05bd44
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
9 changes: 4 additions & 5 deletions weasyl/define.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import functools
import os
import time
import hashlib
Expand Down Expand Up @@ -948,9 +949,8 @@ def query_string(query):
return urlencode(pairs)


def _requests_wrapper(func_name):
func = getattr(requests, func_name)

def _requests_wrapper(func):
@functools.wraps(func)
def wrapper(*a, **kw):
try:
return func(*a, **kw)
Expand All @@ -962,8 +962,7 @@ def wrapper(*a, **kw):
return wrapper


http_get = _requests_wrapper('get')
http_post = _requests_wrapper('post')
http_get = _requests_wrapper(requests.get)


def metric(*a, **kw):
Expand Down
1 change: 0 additions & 1 deletion weasyl/login.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
from io import open

import bcrypt
from publicsuffixlist import PublicSuffixList
Expand Down
4 changes: 2 additions & 2 deletions weasyl/turnstile.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _check(request) -> Result:
error_codes = turnstile_validation["error-codes"]

if not {"invalid-input-response", "timeout-or-duplicate"}.issuperset(error_codes):
logger.warn("Unexpected Turnstile error codes: %r", error_codes) # pragma: no cover
logger.warning("Unexpected Turnstile error codes: %r", error_codes) # pragma: no cover

return Result.INVALID

Expand All @@ -68,4 +68,4 @@ def require(request) -> None:
if result == Result.NOT_LOADED:
logger.info("Form submitted without Turnstile field in non-enforcing mode")
else:
logger.warn("Turnstile validation failed in non-enforcing mode: %s", result)
logger.warning("Turnstile validation failed in non-enforcing mode: %s", result)

0 comments on commit f05bd44

Please sign in to comment.