Skip to content

Commit

Permalink
DNSPython: 2.0.0 changes (use resolve, not query)
Browse files Browse the repository at this point in the history
Looks like dnsresolver class with the modifiable resolver class in here for configuration and use in the `!!/ip` call we used a while ago for DNS lookups of things (when we were debugging differing DNS records for domains) did not get the changes that #5117 was going to implement.  So, implement.
  • Loading branch information
teward authored Nov 16, 2020
1 parent 82405e8 commit b79c7e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions classes/dnsresolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ def dns_resolve(domain: str, resolver: DNSResolver = DNSResolver(configure=True)
addrs = []

try:
for answer in resolver.query(domain, 'A').response.answer:
for answer in resolver.resolve(domain, 'A').response.answer:
for item in answer:
if item.rdtype == dns.rdatatype.A:
addrs.append(item.address)
except dns.resolver.NoAnswer:
pass

try:
for answer in resolver.query(domain, 'AAAA').response.answer:
for answer in resolver.resolve(domain, 'AAAA').response.answer:
for item in answer:
if item.rdtype == dns.rdatatype.AAAA:
addrs.append(item.address)
Expand Down

0 comments on commit b79c7e7

Please sign in to comment.