fix ruff S310 audit warnings in fpaste

This commit is contained in:
Username
2025-12-25 21:08:48 +01:00
parent 033751d8e5
commit 0c8bdacfd2

4
fpaste
View File

@@ -134,10 +134,10 @@ def request(
) -> tuple[int, bytes, dict[str, str]]:
"""Make HTTP request and return (status, body, headers)."""
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:
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)
except urllib.error.HTTPError as e:
return e.code, e.read(), dict(e.headers)