Fix dns query for old dnspython lib
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michel Roux 2022-11-13 18:48:45 +01:00
parent bb1d4f6dc7
commit e1c79db857

View File

@ -41,13 +41,13 @@ class DNSAdapter(adapters.HTTPAdapter):
if HAS_IPV6: if HAS_IPV6:
try: try:
answers_v6 = DNS_RESOLVER.resolve(host, rdatatype.AAAA) answers_v6 = DNS_RESOLVER.query(host, rdatatype.AAAA)
for rdata_v6 in answers_v6: for rdata_v6 in answers_v6:
return f"[{str(rdata_v6)}]" return f"[{str(rdata_v6)}]"
except resolver.NoAnswer: except resolver.NoAnswer:
pass pass
answers_v4 = DNS_RESOLVER.resolve(host, rdatatype.A) answers_v4 = DNS_RESOLVER.query(host, rdatatype.A)
for rdata_v4 in answers_v4: for rdata_v4 in answers_v4:
return str(rdata_v4) return str(rdata_v4)