From 5599863f186f324b431fa95eb0bfa53f8d67c1eb Mon Sep 17 00:00:00 2001 From: Christophe de Vienne Date: Tue, 8 Apr 2014 12:10:38 +0200 Subject: [PATCH] Discover the dns server only once --- validate_email.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validate_email.py b/validate_email.py index ba909fa..6d945a8 100644 --- a/validate_email.py +++ b/validate_email.py @@ -25,6 +25,7 @@ import socket try: import DNS ServerError = DNS.ServerError + DNS.DiscoverNameServers() except ImportError: DNS = None @@ -123,7 +124,6 @@ def validate_email(email, check_mx=False, verify=False, debug=False, smtp_timeou if not DNS: raise Exception('For check the mx records or check if the email exists you must ' 'have installed pyDNS python package') - DNS.DiscoverNameServers() hostname = email[email.find('@') + 1:] mx_hosts = get_mx_ip(hostname) if mx_hosts is None: