1
0
Fork 0
mirror of https://github.com/fastogt/pyfastogt synced 2025-02-14 19:11:55 +00:00

Change email validation

This commit is contained in:
topilski 2020-04-29 07:03:46 -04:00
parent 4e4a544e00
commit 77b7fab955
2 changed files with 6 additions and 5 deletions

View file

@ -10,7 +10,7 @@ import tarfile
from urllib.request import urlopen from urllib.request import urlopen
import certifi import certifi
from validate_email import validate_email from email_validator import validate_email, EmailNotValidError
class CommonError(Exception): class CommonError(Exception):
@ -21,9 +21,10 @@ class CommonError(Exception):
return self.value_ return self.value_
def is_valid_email(email: str, check_mx: bool) -> bool: def is_valid_email(email: str) -> bool:
dns_valid = validate_email(email, check_mx=check_mx) try:
if not dns_valid: validate_email(email)
except EmailNotValidError as e:
return False return False
validate_url = 'https://open.kickbox.com/v1/disposable/' + email validate_url = 'https://open.kickbox.com/v1/disposable/' + email

View file

@ -23,7 +23,7 @@ VERSION = '1.0.0'
# What packages are required for this module to be executed? # What packages are required for this module to be executed?
REQUIRED = [ REQUIRED = [
'validate_email', 'email-validator',
'distro', 'distro',
'certifi', 'certifi',
'requests' 'requests'