From b03ad5dc018cc85fd5905011d74de1cc4c234cd9 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Thu, 23 Nov 2023 13:11:59 -0800 Subject: [PATCH 1/1] fetch: Use a session --- paperdoorknob.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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: -- 2.44.1