From 8f18e98fc2fbe451195c2b84cdb0c87414399baf Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Mon, 23 Nov 2020 09:47:38 -0500 Subject: Work with older dnspython for dkim calls If we find an older dnspython < 2.0, don't crash but let dkim figure out how it wants to look up TXT records on its own. Signed-off-by: Konstantin Ryabitsev --- b4/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/b4/__init__.py b/b4/__init__.py index d21aab2..c1e0826 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -2353,6 +2353,10 @@ def dkim_get_txt(name: bytes, timeout: int = 5): if txtdata.find(b'p=') >= 0: _DKIM_DNS_CACHE[name] = txtdata return txtdata + except AttributeError: + # Try the native call + _DKIM_DNS_CACHE[name] = dkim.dnsplug.get_txt(name, timeout) + return _DKIM_DNS_CACHE[name] except dns.resolver.NXDOMAIN: pass _DKIM_DNS_CACHE[name] = None -- cgit v1.2.3