From: Brian Wellington Date: Fri, 25 Mar 2022 20:23:07 +0000 (-0700) Subject: Fix passing source address with httpx. X-Git-Tag: v2.3.0rc1~78^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F798%2Fhead;p=thirdparty%2Fdnspython.git Fix passing source address with httpx. When dns.query.https() is passed a source address, it needs to create an adapter for either requests or httpx to use it. As it doesn't know which one will actually be used, it creates both. But then if it decides to use httpx, it attempts to attach the requests adapter, which fails. --- diff --git a/dns/query.py b/dns/query.py index 7fa50b93..5663e234 100644 --- a/dns/query.py +++ b/dns/query.py @@ -390,7 +390,7 @@ def https( else: cm = requests.sessions.Session() with cm as session: - if transport_adapter: + if transport_adapter and not _is_httpx: session.mount(url, transport_adapter) # see https://tools.ietf.org/html/rfc8484#section-4.1.1 for DoH