How to use the tldextract.remote.find_first_response function in tldextract

To help you get started, we’ve selected a few tldextract examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github john-kurkowski / tldextract / tldextract / tldextract.py View on Github external
__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.")

tldextract

Accurately separates a URL's subdomain, domain, and public suffix, using the Public Suffix List (PSL). By default, this includes the public ICANN TLDs and their exceptions. You can optionally support the Public Suffix List's private domains as well.

BSD-3-Clause
Latest version published 3 days ago

Package Health Score

88 / 100
Full package analysis

Similar packages