]> git.scottworley.com Git - paperdoorknob/commitdiff
fetch: Try closing connections more aggressively
authorScott Worley <scottworley@scottworley.com>
Thu, 23 Nov 2023 20:31:24 +0000 (12:31 -0800)
committerScott Worley <scottworley@scottworley.com>
Wed, 20 Dec 2023 01:37:10 +0000 (17:37 -0800)
paperdoorknob.py

index cd93e4ef69c24b84679432ac0a5d6435aff6e813..70f3af5d5c075c47ef54d8256e35d75e1ab63a45 100644 (file)
@@ -20,8 +20,8 @@ def command_line_parser() -> ArgumentParser:
 
 
 def fetch(url: str, timeout: int) -> None:
 
 
 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:
 
 
 def main() -> None: