Skip to content

Commit

Permalink
use the altest version of PSL database
Browse files Browse the repository at this point in the history
  • Loading branch information
martenson committed Feb 5, 2018
1 parent deb67ee commit c21350a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
publicsuffixlist
requests
13 changes: 11 additions & 2 deletions verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
import sys

from publicsuffixlist import PublicSuffixList
from requests import get

def main(arguments):
psl = PublicSuffixList()
suffix_detected = False

psl = None
download_suffixes()
with open("public_suffix_list.dat", "r") as latest:
psl = PublicSuffixList(latest)
with io.open('disposable_email_blacklist.conf', 'r') as deb:
for i, line in enumerate(deb):
current_line = line.strip()
Expand All @@ -23,6 +26,12 @@ def main(arguments):
print ('At least one valid public suffix found in the blacklist, please remove it. See https://publicsuffix.org for details on why this shouldn\'t be blacklisted.')
sys.exit(1)

def download_suffixes():
with open('public_suffix_list.dat', "wb") as file:
response = get('https://publicsuffix.org/list/public_suffix_list.dat')
file.write(response.content)



if __name__ == "__main__":
main(sys.argv)

0 comments on commit c21350a

Please sign in to comment.