Skip to content

Commit

Permalink
Fail fast when cache_fetch_timeout is unsupported type
Browse files Browse the repository at this point in the history
  • Loading branch information
john-kurkowski committed Oct 25, 2017
1 parent 4da4517 commit 35e1ffc
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions tldextract/tldextract.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,8 @@ def __init__(self, cache_file=CACHE_FILE, suffix_list_urls=PUBLIC_SUFFIX_LIST_UR
self._extractor = None

self.cache_fetch_timeout = cache_fetch_timeout
if not isinstance(self.cache_fetch_timeout, (tuple, float,)):
try:
self.cache_fetch_timeout = float(self.cache_fetch_timeout)
except (ValueError, TypeError):
LOG.error(
'invalid cache timeout specified (%s). Defaulting to None',
self.cache_fetch_timeout,
exc_info=True
)
if isinstance(self.cache_fetch_timeout, STRING_TYPE):
self.cache_fetch_timeout = float(self.cache_fetch_timeout)

def __call__(self, url):
"""
Expand Down

0 comments on commit 35e1ffc

Please sign in to comment.