]> git.scottworley.com Git - paperdoorknob/blobdiff - paperdoorknob.py
fetch: test: Explicitly close webserver
[paperdoorknob] / paperdoorknob.py
index cd93e4ef69c24b84679432ac0a5d6435aff6e813..70f3af5d5c075c47ef54d8256e35d75e1ab63a45 100644 (file)
@@ -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: