1
0

Avoid cookiejar if cache is disabled
Some checks failed
Test Python / Test (push) Has been cancelled

This commit is contained in:
Jon Michael Aanes 2024-06-03 00:20:46 +02:00
parent 64772116a3
commit ea3d27dee6
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA

View File

@ -195,12 +195,12 @@ if cfscrape:
pass 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) assert isinstance(with_cfscrape, bool)
session_class = requests_cache.CachedSession session_class = requests_cache.CachedSession
if ignore_cache: if ignore_cache:
session_class = requests.Session
logger.warn('HTTP cache disabled') logger.warn('HTTP cache disabled')
return requests.Session()
if cfscrape: if cfscrape:
session_class = CachedCfScrape session_class = CachedCfScrape
session = session_class('output/web_cache', cookies=cookiejar) session = session_class('output/web_cache', cookies=cookiejar)