diff --git a/blacklists.py b/blacklists.py index 2d64a459b3..8e76dca9e5 100644 --- a/blacklists.py +++ b/blacklists.py @@ -298,12 +298,12 @@ def item_check(ns): if item.get('disable', None): return False try: - addr = dns.resolver.query(ns, 'a') + addr = dns.resolver.resolve(ns, 'a') log('debug', '{0} resolved to {1}'.format( ns, ','.join(x.to_text() for x in addr))) except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer): if not item.get('pass', None): - soa = dns.resolver.query(ns, 'soa') + soa = dns.resolver.resolve(ns, 'soa') log('debug', '{0} has no A record; SOA is {1}'.format( ns, ';'.join(s.to_text() for s in soa))) except dns.resolver.NoNameservers: diff --git a/findspam.py b/findspam.py index fd86c623b2..897a0016a3 100644 --- a/findspam.py +++ b/findspam.py @@ -1035,7 +1035,9 @@ def dns_query(label, qtype): return DNS_CACHE[(label, qtype)]['result'] try: starttime = datetime.utcnow() - answer = dns.resolver.query(label, qtype) + # Switched from dns.resolver.query + # See also https://github.com/rthalley/dnspython/issues/581 + answer = dns.resolver.resolve(label, qtype) except dns.exception.DNSException as exc: if str(exc).startswith('None of DNS query names exist:'): log('debug', 'DNS label {0} not found; skipping'.format(label)) diff --git a/requirements.txt b/requirements.txt index e2bd06fb96..a2347ea817 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ regex>=2020.10.23 termcolor>=1.1.0 sh>=1.12.14 typing>=3.6.4 -dnspython>=1.15.0 +dnspython>=2.0.0 PyYAML>=3.12 msgpack-python>=0.5.6 colorama>=0.4.1