From effd970dd1f476bcb0266c52d79a0a825246543e Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Fri, 25 Mar 2022 13:23:07 -0700 Subject: [PATCH] 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. --- dns/query.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.47.3