Added requirements.txt

This commit is contained in:
Ben Baert 2018-06-01 14:05:00 +02:00
parent a110914328
commit 29dde38a84
5 changed files with 9 additions and 6 deletions

View file

@ -15,15 +15,14 @@ def get_mx_records(domain):
return [str(x.exchange) for x in records]
def mx_check(email_address):
def mx_check(email_address, timeout=10):
host = socket.gethostname()
smtp = smtplib.SMTP()
smtp = smtplib.SMTP(timeout=timeout)
smtp.set_debuglevel(0)
domain = get_domain_from_email_address(email_address)
mx_records = get_mx_records(domain)
print(mx_records)
for mx_record in mx_records:
smtp.connect(mx_record)

View file

@ -34,4 +34,4 @@ def validate_email(
if not check_mx:
return True
return mx_check(email_address)
return mx_check(email_address, timeout=smtp_timeout)

1
requirements.txt Normal file
View file

@ -0,0 +1 @@
dnspython

View file

@ -1,3 +1,6 @@
[nosetests]
verbosity=3
with-doctest=1
[metadata]
description-file = README.rst

View file

@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name="pyemailval",
version="1.0",
version="0.1",
download_url="git@github.com:ben-baert/pyemailval.git",
py_modules=("pyemailval",),
author="Ben Baert",