File tree Expand file tree Collapse file tree 3 files changed +9
-15
lines changed
Expand file tree Collapse file tree 3 files changed +9
-15
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ def get_version(version_file):
9292 install_requires = [
9393 "dnspython" ,
9494 "docopt" ,
95- "publicsuffix " ,
95+ "publicsuffixlist[update] " ,
9696 "py3dns" ,
9797 "pyspf" ,
9898 "requests" ,
Original file line number Diff line number Diff line change 11"""This file defines the version of this module."""
2- __version__ = "0.8.0 "
2+ __version__ = "0.8.1 "
Original file line number Diff line number Diff line change 77from typing import Dict
88
99# Third-Party Libraries
10- import publicsuffix
10+ from publicsuffixlist .compat import PublicSuffixList
11+ from publicsuffixlist .update import updatePSL
1112
1213from . import PublicSuffixListFilename , PublicSuffixListReadOnly , trustymail
1314
1415
1516def get_psl ():
16- """
17- Get the Public Suffix List - either new, or cached in the CWD for 24 hours.
17+ """Get the Public Suffix List - either new, or cached in the CWD for 24 hours.
1818
1919 Returns
2020 -------
2121 PublicSuffixList: An instance of PublicSuffixList loaded with a cached or updated list
2222 """
23-
24- def download_psl ():
25- fresh_psl = publicsuffix .fetch ()
26- with open (PublicSuffixListFilename , "w" , encoding = "utf-8" ) as fresh_psl_file :
27- fresh_psl_file .write (fresh_psl .read ())
28-
29- # Download the psl if necessary
23+ # Download the PSL if necessary
3024 if not PublicSuffixListReadOnly :
3125 if not path .exists (PublicSuffixListFilename ):
32- download_psl ( )
26+ updatePSL ( PublicSuffixListFilename )
3327 else :
3428 psl_age = datetime .now () - datetime .fromtimestamp (
3529 stat (PublicSuffixListFilename ).st_mtime
3630 )
3731 if psl_age > timedelta (hours = 24 ):
38- download_psl ( )
32+ updatePSL ( PublicSuffixListFilename )
3933
4034 with open (PublicSuffixListFilename , encoding = "utf-8" ) as psl_file :
41- psl = publicsuffix . PublicSuffixList (psl_file )
35+ psl = PublicSuffixList (psl_file )
4236
4337 return psl
4438
You can’t perform that action at this time.
0 commit comments