From ea3d27dee6a01dffb483d56940515e9813e958b0 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Mon, 3 Jun 2024 00:20:46 +0200 Subject: [PATCH] Avoid cookiejar if cache is disabled --- personal_data/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/personal_data/main.py b/personal_data/main.py index f9de35d..949fcdc 100644 --- a/personal_data/main.py +++ b/personal_data/main.py @@ -195,12 +195,12 @@ if cfscrape: pass -def get_session(cookiejar, *, with_cfscrape: bool, ignore_cache: bool) -> requests.Session: +def get_session(cookiejar: Sequence, *, with_cfscrape: bool, ignore_cache: bool) -> requests.Session: assert isinstance(with_cfscrape, bool) session_class = requests_cache.CachedSession if ignore_cache: - session_class = requests.Session logger.warn('HTTP cache disabled') + return requests.Session() if cfscrape: session_class = CachedCfScrape session = session_class('output/web_cache', cookies=cookiejar)