From: Bob Halley Date: Tue, 16 Nov 2021 14:36:17 +0000 (-0800) Subject: fix session check when httpx is not installed X-Git-Tag: v2.2.0rc1~30^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abac716478847c4551e238ad8e25d01ba115f241;p=thirdparty%2Fdnspython.git fix session check when httpx is not installed --- diff --git a/dns/query.py b/dns/query.py index 1111e089..314d8d83 100644 --- a/dns/query.py +++ b/dns/query.py @@ -328,7 +328,10 @@ def https(q, where, timeout=None, port=443, source=None, source_port=0, transport_adapter = SourceAddressAdapter(source) if session: - _is_httpx = isinstance(session, httpx.Client) + if _have_httpx: + _is_httpx = isinstance(session, httpx.Client) + else: + _is_httpx = False if _is_httpx and not _httpx_ok: raise NoDOH('Session is httpx, but httpx cannot be used for ' 'the requested operation.')