mitigate spamhaus dns fail while querying for dnsbl

This commit is contained in:
Spitap
2022-07-29 16:43:15 +02:00
parent 4474d68337
commit ed9e12d2f7
@@ -79,6 +79,9 @@ class CheckMXRecords(BaseCommand):
pattern = "{}.{}.".format(reverse, provider)
try:
result = socket.gethostbyname(pattern)
#Mitigate Spamhaus status error (these codes don't mean ip is listed)
if result == "127.255.255.254" or result == "127.255.255.255":
result = False
except socket.gaierror:
result = False
for mx in mxs: