Don't ship PSL
Committed 94bdff
--- a/.gitignore
+++ b/.gitignore
--- a/easyuri/__init__.py
+++ b/easyuri/__init__.py
import hstspreload
import pkg_resources
+import requests
__all__ = ["parse", "supported_schemes"]
input_path = pkg_resources.resource_filename(
"easyuri", "public_suffix_list.dat"
)
- # try:
- with codecs.open(input_path, "r", "utf8") as fp:
- self._build_structure(fp)
- # except FileNotFoundError:
- # res = requests.get("https://publicsuffix.org/list/public_suffix_list.dat")
- # with codecs.open(input_path, "w", "utf8") as fp:
- # fp.write(res.text)
- # with codecs.open(input_path, "r", "utf8") as fp:
- # self._build_structure(fp)
+ try:
+ with codecs.open(input_path, "r", "utf8") as fp:
+ self._build_structure(fp)
+ except FileNotFoundError:
+ res = requests.get("https://publicsuffix.org/list/public_suffix_list.dat")
+ with codecs.open(input_path, "w", "utf8") as fp:
+ fp.write(res.text)
+ with codecs.open(input_path, "r", "utf8") as fp:
+ self._build_structure(fp)
def lookup(self, matches, depth, parts, parent=None):
if parent is None: