From: Scott Worley Date: Thu, 23 Nov 2023 21:11:59 +0000 (-0800) Subject: fetch: Use a session X-Git-Url: http://git.scottworley.com/paperdoorknob/commitdiff_plain/b03ad5dc018cc85fd5905011d74de1cc4c234cd9?ds=inline;hp=17bd16e89158461d82af7cab2a99a36063ff46b1 fetch: Use a session --- diff --git a/paperdoorknob.py b/paperdoorknob.py index 70f3af5..c684739 100644 --- a/paperdoorknob.py +++ b/paperdoorknob.py @@ -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: