Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception reading Public Suffix List url #334

Closed
petroslamb opened this issue Jun 27, 2024 · 3 comments
Closed

Exception reading Public Suffix List url #334

petroslamb opened this issue Jun 27, 2024 · 3 comments

Comments

@petroslamb
Copy link

Seems that the cache is not loaded for some reason?

I can see some json files deep under ~/.cache/python-tldextract have been created and I think I have whitelisted the right IP ranges to allow fetching TLD lists, the original error was Cannot download list of TLDs. so I am past that. Any idea what is causeing this?

Exception reading Public Suffix List url https://publicsuffix.org/list/public_suffix_list.dat
Traceback (most recent call last):
  File "/home/workable/app/.venv/lib/python3.11/site-packages/tldextract/cache.py", line 206, in run_and_cache
    result = cast(T, self.get(namespace=namespace, key=key_args))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/workable/app/.venv/lib/python3.11/site-packages/tldextract/cache.py", line 100, in get
    raise KeyError("namespace: " + namespace + " key: " + repr(key))
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}"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/workable/app/.venv/lib/python3.11/site-packages/tldextract/cache.py", line 206, in run_and_cache
    result = cast(T, self.get(namespace=namespace, key=key_args))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/workable/app/.venv/lib/python3.11/site-packages/tldextract/cache.py", line 100, in get
    raise KeyError("namespace: " + namespace + " key: " + repr(key))
KeyError: "namespace: urls key: {'url': 'https://publicsuffix.org/list/public_suffix_list.dat'}"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/workable/app/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 793, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/workable/app/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 491, in _make_request
    raise new_e
  File "/home/workable/app/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 467, in _make_request
    self._validate_conn(conn)
  File "/home/workable/app/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1099, in _validate_conn
    conn.connect()
  File "/home/workable/app/.venv/lib/python3.11/site-packages/urllib3/connection.py", line 653, in connect
    sock_and_verified = _ssl_wrap_socket_and_match_hostname(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/workable/app/.venv/lib/python3.11/site-packages/urllib3/connection.py", line 806, in _ssl_wrap_socket_and_match_hostname
    ssl_sock = ssl_wrap_socket(
             … [message truncated due to size]

tldextract 3.5.0
Python 3.11.9

@petroslamb
Copy link
Author

Looks somewhat related to #332

@john-kurkowski
Copy link
Owner

After your error, does the library function as expected with the latest public suffix definitions? Or do you get no results, the library's unusable?

The "Exception reading Public Suffix List url" message is trying the 1st of 2 default URLs for public suffix definitions. It's possible the 2nd URL succeeds and the library works as expected for you. (Still, I've reduced the "Exception reading Public Suffix List url" from an error to a warning in 921a825.)

… [message truncated due to size]

I wonder what that urllib3 exception is. It might indicate trouble reaching publicsuffix.org. It also might be a red herring, as your log seems to collect several benign exceptions that happened in recent time even if they were handled.

@petroslamb
Copy link
Author

Yes the library is useable and I think I have managed to mitigate this error by whitelisting a wider range of ips. This error might also appear in cases of intermittent connectivity. Thanks for your answer on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants