john-kurkowski/tldextract

How to make tldextract do not down load public_suffix_list.dat

Opened this issue · 3 comments

I want to use the DrissionPage deponds on tldextract in offline env.
I use pyinstaller packaged my project. The exception throwed when I run the App.

Exception reading Public Suffix List url https://publicsuffix.org/list/public_suffix_list.dat
Traceback (most recent call last):
File "tldextract\cache.py", line 209, in run_and_cache
File "tldextract\cache.py", line 111, in get
KeyError: "namespace: publicsuffix.org-tlds key: {'urls': ('https://publicsuffix.org/list/public_suffix_list.dat', 'https://raw.githubusercontent.com/publicsuffix/list/master/public_suffix_list.dat'), 'fallback_to_snapshot': True}"

I have the same issue, also trying setting suffix_list_urls=None in main() but no luck, will there be a global option to disable default live http request?

Could you share repro steps? The full code you're using and the full error message?

When I clear my cache

>>> import tldextract

>>> tldextract.tldextract.update()

disconnect from the Internet, then run these 2 lines from the README about no live HTTP fetching,

>>> no_fetch_extract = tldextract.TLDExtract(suffix_list_urls=())
>>> no_fetch_extract('http://www.google.com')
ExtractResult(subdomain='www', domain='google', suffix='com', is_private=False)

it works for me, no raised exception.

Possibly related feature request: #233.