From: Scott Worley Date: Thu, 23 Nov 2023 20:31:24 +0000 (-0800) Subject: fetch: Try closing connections more aggressively X-Git-Url: http://git.scottworley.com/paperdoorknob/commitdiff_plain/21723d3dc64cdfd14119315cd5e9e0f55b175cc8 fetch: Try closing connections more aggressively --- diff --git a/paperdoorknob.py b/paperdoorknob.py index cd93e4e..70f3af5 100644 --- a/paperdoorknob.py +++ b/paperdoorknob.py @@ -20,8 +20,8 @@ def command_line_parser() -> ArgumentParser: def fetch(url: str, timeout: int) -> None: - r = requests.get(url, timeout=timeout) - r.raise_for_status() + with requests.get(url, timeout=timeout) as r: + r.raise_for_status() def main() -> None: