Revert dnspython to 1.x

This commit is contained in:
Raphael Michel
2022-01-26 16:15:12 +01:00
parent 6f30c347c0
commit 66f75a5614
2 changed files with 3 additions and 2 deletions

View File

@@ -42,7 +42,8 @@ logger = logging.getLogger(__name__)
def get_spf_record(hostname):
try:
for resp in dns.resolver.resolve(hostname, 'TXT'):
r = dns.resolver.Resolver()
for resp in r.query(hostname, 'TXT'):
data = b''.join(resp.strings).decode()
if data.lower().strip().startswith('v=spf1 '): # RFC7208, section 4.5
return data