Accept NoAnswer as a valid DNS response

This commit is contained in:
Disassembler 2020-08-26 19:09:06 +02:00
parent ccec8faff6
commit 9d18f665c5
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499

View File

@ -44,7 +44,7 @@ def resolve_ip(domain, query_type):
# Resolve domain name using Cloudflare Public DNS # Resolve domain name using Cloudflare Public DNS
try: try:
return resolver.query(domain, query_type)[0].address return resolver.query(domain, query_type)[0].address
except dns.resolver.NXDOMAIN: except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
return None return None
def ping_url(url): def ping_url(url):