fix MX record can be unavailable

This commit is contained in:
Son NK 2019-12-07 23:42:57 +01:00
parent 5854ab8e10
commit d0f95e81b2

View file

@ -2,7 +2,11 @@ import dns.resolver
def get_mx_domains(hostname) -> [str]:
answers = dns.resolver.query(hostname, "MX")
try:
answers = dns.resolver.query(hostname, "MX")
except dns.resolver.NoAnswer:
return []
ret = []
for a in answers: