File: pubsuffix.diff

package info (click to toggle)
tldextract 5.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 532 kB
  • sloc: python: 1,644; makefile: 10
file content (39 lines) | stat: -rw-r--r-- 1,448 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Author: Michel Le Bihan <michel@lebihan.pl>
Subject: Use list of suffixes from publicsuffix package

--- a/tldextract/suffix_list.py
+++ b/tldextract/suffix_list.py
@@ -106,10 +106,8 @@
         )
     except SuffixListNotFound as exc:
         if fallback_to_snapshot:
-            maybe_pkg_data = pkgutil.get_data("tldextract", ".tld_set_snapshot")
-            # package maintainers guarantee file is included
-            pkg_data = cast(bytes, maybe_pkg_data)
-            text = pkg_data.decode("utf-8")
+            with open("/usr/share/publicsuffix/public_suffix_list.dat") as public_suffix_file:
+                text = public_suffix_file.read()
         else:
             raise exc
 
--- a/tldextract/tldextract.py
+++ b/tldextract/tldextract.py
@@ -56,8 +56,7 @@
 CACHE_TIMEOUT = os.environ.get("TLDEXTRACT_CACHE_TIMEOUT")
 
 PUBLIC_SUFFIX_LIST_URLS = (
-    "https://publicsuffix.org/list/public_suffix_list.dat",
-    "https://raw.githubusercontent.com/publicsuffix/list/master/public_suffix_list.dat",
+    "file:///usr/share/publicsuffix/public_suffix_list.dat",
 )
 
 
@@ -149,7 +148,7 @@
     def __init__(
         self,
         cache_dir: str | None = get_cache_dir(),
-        suffix_list_urls: Sequence[str] = PUBLIC_SUFFIX_LIST_URLS,
+        suffix_list_urls: Sequence[str] = (),
         fallback_to_snapshot: bool = True,
         include_psl_private_domains: bool = False,
         extra_suffixes: Sequence[str] = (),