Merge ~pedrovfer/dkimpy:fix/warning_dns_resolve into dkimpy:master

Proposed by Pedro Vicente
Status: Merged
Merge reported by: Scott Kitterman
Merged at revision: aa50562f63be5aa0b1a156198305fbf3000b1e60
Proposed branch: ~pedrovfer/dkimpy:fix/warning_dns_resolve
Merge into: dkimpy:master
Diff against target: 26 lines (+2/-2)
2 files modified
dkim/dnsplug.py (+1/-1)
setup.py (+1/-1)
Reviewer Review Type Date Requested Status
Scott Kitterman Needs Information
Review via email: mp+447796@code.launchpad.net

Description of the change

call dns.resolver.resolve() instead of dns.resolver.query

/python3.10/site-packages/dkim/dnsplug.py:32: DeprecationWarning: please use dns.resolver.resolve() instead
    a = dns.resolver.query(name, dns.rdatatype.TXT,raise_on_no_answer=False, lifetime=timeout)

To post a comment you must log in.
Revision history for this message
Scott Kitterman (kitterman) wrote :

I think that's good. Do you know when dns.resolver was introduced? We should also probably set the minimum version for dnspython accordingly.

review: Needs Information
Revision history for this message
Pedro Vicente (pedrovfer) :
aa50562... by Pedro Vicente <email address hidden>

Change minimun version for dnspython due to deprecation warning

Revision history for this message
Pedro Vicente (pedrovfer) wrote :

> I think that's good. Do you know when dns.resolver was introduced? We should
> also probably set the minimum version for dnspython accordingly.

Commit was https://github.com/rthalley/dnspython/commit/997e913cd19553413a7545c7568f2917c0e396c2 and targets 2.0 major version, https://github.com/rthalley/dnspython/releases/tag/v2.0.0

I'll change the minimum version to 2.0 in this merge request

Revision history for this message
Scott Kitterman (kitterman) wrote :

Great. Thanks.

Revision history for this message
Pedro Vicente (pedrovfer) wrote :

> Great. Thanks.

Hi Scott, are you planning to merge it anytime soon and release a new version?

It would be great to have a timeline for it so I can be ready for the lib update in our product.

Many thanks,
Pedro

Revision history for this message
Scott Kitterman (kitterman) wrote :

Thanks. I'll do a release shortly.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/dkim/dnsplug.py b/dkim/dnsplug.py
2index 1ea8e3a..5c80571 100644
3--- a/dkim/dnsplug.py
4+++ b/dkim/dnsplug.py
5@@ -29,7 +29,7 @@ def get_txt_dnspython(name, timeout=5):
6 """Return a TXT record associated with a DNS name."""
7 import dkim
8 try:
9- a = dns.resolver.query(name, dns.rdatatype.TXT,raise_on_no_answer=False, lifetime=timeout)
10+ a = dns.resolver.resolve(name, dns.rdatatype.TXT,raise_on_no_answer=False, lifetime=timeout, search=True)
11 for r in a.response.answer:
12 if r.rdtype == dns.rdatatype.TXT:
13 return b"".join(list(r.items)[0].strings)
14diff --git a/setup.py b/setup.py
15index 26dc2d1..875f727 100644
16--- a/setup.py
17+++ b/setup.py
18@@ -32,7 +32,7 @@ try:
19 import DNS
20 kw['install_requires'] = ['Py3DNS']
21 except ImportError: # If PyDNS is not installed, prefer dnspython
22- kw['install_requires'] = ['dnspython>=1.16.0']
23+ kw['install_requires'] = ['dnspython>=2.0.0']
24
25 with open("README.md", "r") as fh:
26 long_description = fh.read()

Subscribers

People subscribed via source and target branches

to all changes: