forked from claw/flaskpaste
fix ruff S310 audit warnings in fpaste
This commit is contained in:
4
fpaste
4
fpaste
@@ -134,10 +134,10 @@ def request(
|
|||||||
) -> tuple[int, bytes, dict[str, str]]:
|
) -> tuple[int, bytes, dict[str, str]]:
|
||||||
"""Make HTTP request and return (status, body, headers)."""
|
"""Make HTTP request and return (status, body, headers)."""
|
||||||
headers = headers or {}
|
headers = headers or {}
|
||||||
req = urllib.request.Request(url, data=data, headers=headers, method=method)
|
req = urllib.request.Request(url, data=data, headers=headers, method=method) # noqa: S310
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with urllib.request.urlopen(req, timeout=30, context=ssl_context) as resp: # nosec B310
|
with urllib.request.urlopen(req, timeout=30, context=ssl_context) as resp: # noqa: S310 # nosec B310
|
||||||
return resp.status, resp.read(), dict(resp.headers)
|
return resp.status, resp.read(), dict(resp.headers)
|
||||||
except urllib.error.HTTPError as e:
|
except urllib.error.HTTPError as e:
|
||||||
return e.code, e.read(), dict(e.headers)
|
return e.code, e.read(), dict(e.headers)
|
||||||
|
|||||||
Reference in New Issue
Block a user