From 581c283d34987c3904e41b649662d22ecaefe8df Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Wed, 12 Sep 2018 16:55:52 +0800 Subject: [PATCH] add a default value to TLDEXTRACT_CACHE_TIMEOUT if no default value defined with TLDEXTRACT_CACHE_TIMEOUT, tldextract maybe hang indefinitely since the requests never go through. --- tldextract/tldextract.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tldextract/tldextract.py b/tldextract/tldextract.py index 11eb1d8b..743758ab 100644 --- a/tldextract/tldextract.py +++ b/tldextract/tldextract.py @@ -92,7 +92,7 @@ def resource_stream(cls, _, resource_name): CACHE_FILE_DEFAULT = os.path.join(os.path.dirname(__file__), '.tld_set') CACHE_FILE = os.path.expanduser(os.environ.get("TLDEXTRACT_CACHE", CACHE_FILE_DEFAULT)) -CACHE_TIMEOUT = os.environ.get('TLDEXTRACT_CACHE_TIMEOUT') +CACHE_TIMEOUT = os.environ.get('TLDEXTRACT_CACHE_TIMEOUT', '1') PUBLIC_SUFFIX_LIST_URLS = ( 'https://publicsuffix.org/list/public_suffix_list.dat',