check if COOKIE_FILE is file

This commit is contained in:
Nick Sweeting 2024-02-28 18:19:44 -08:00 committed by GitHub
parent 68326a60ee
commit fe11e1c2f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -174,7 +174,7 @@ def download_url(url: str, timeout: int=None) -> str:
timeout = timeout or TIMEOUT
cookie_jar = http.cookiejar.MozillaCookieJar()
if COOKIES_FILE is not None:
if COOKIES_FILE and Path(COOKIES_FILE).is_file():
cookie_jar.load(COOKIES_FILE, ignore_discard=True, ignore_expires=True)
else:
cookie_jar = None