Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
__init__:
1. Memoized on `self`
2. Local system cache file
3. Remote PSL, over HTTP
4. Bundled PSL snapshot file'''
if self._extractor:
return self._extractor
tlds = self._get_cached_tlds()
if tlds:
tlds.extend(self.extra_suffixes)
self._extractor = _PublicSuffixListTLDExtractor(tlds)
return self._extractor
elif self.suffix_list_urls:
raw_suffix_list_data = find_first_response(
self.suffix_list_urls,
self.cache_fetch_timeout
)
tlds = get_tlds_from_raw_suffix_list_data(
raw_suffix_list_data,
self.include_psl_private_domains
)
if not tlds and self.fallback_to_snapshot:
tlds = self._get_snapshot_tld_extractor()
tlds.extend(self.extra_suffixes)
self._extractor = _PublicSuffixListTLDExtractor(tlds)
return self._extractor
elif not tlds:
raise Exception("tlds is empty, but fallback_to_snapshot is set"
" to false. Cannot proceed without tlds.")