mirror of
https://github.com/disposable-email-domains/disposable-email-domains.git
synced 2024-12-12 09:54:39 +08:00
Merge pull request #141 from martenson/latest-suffix
use the latest version of PSL database
This commit is contained in:
commit
a28e06c3b0
@ -1 +1,2 @@
|
|||||||
publicsuffixlist
|
publicsuffixlist
|
||||||
|
requests
|
||||||
|
13
verify.py
13
verify.py
@ -7,11 +7,14 @@ import io
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from publicsuffixlist import PublicSuffixList
|
from publicsuffixlist import PublicSuffixList
|
||||||
|
from requests import get
|
||||||
|
|
||||||
def main(arguments):
|
def main(arguments):
|
||||||
psl = PublicSuffixList()
|
|
||||||
suffix_detected = False
|
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:
|
with io.open('disposable_email_blacklist.conf', 'r') as deb:
|
||||||
for i, line in enumerate(deb):
|
for i, line in enumerate(deb):
|
||||||
current_line = line.strip()
|
current_line = line.strip()
|
||||||
@ -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.')
|
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)
|
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__":
|
if __name__ == "__main__":
|
||||||
main(sys.argv)
|
main(sys.argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user