]> git.scottworley.com Git - paperdoorknob/commitdiff
fetch: Use a session
authorScott Worley <scottworley@scottworley.com>
Thu, 23 Nov 2023 21:11:59 +0000 (13:11 -0800)
committerScott Worley <scottworley@scottworley.com>
Wed, 20 Dec 2023 01:37:10 +0000 (17:37 -0800)
paperdoorknob.py

index 70f3af5d5c075c47ef54d8256e35d75e1ab63a45..c684739e0a363ee310e27343a08effde2bb4dc89 100644 (file)
@@ -20,8 +20,9 @@ def command_line_parser() -> ArgumentParser:
 
 
 def fetch(url: str, timeout: int) -> None:
-    with requests.get(url, timeout=timeout) as r:
-        r.raise_for_status()
+    with requests.session() as s:
+        with s.get(url, timeout=timeout) as r:
+            r.raise_for_status()
 
 
 def main() -> None: