diff --git a/ddtrace/contrib/httpx/patch.py b/ddtrace/contrib/httpx/patch.py index 35379ddd598..bbeace21220 100644 --- a/ddtrace/contrib/httpx/patch.py +++ b/ddtrace/contrib/httpx/patch.py @@ -24,6 +24,8 @@ from ddtrace import Span from ddtrace.vendor.wrapt import BoundFunctionWrapper +HTTPX_VERSION = tuple(map(int, httpx.__version__.split("."))) + config._add( "httpx", { @@ -39,7 +41,14 @@ def _url_to_str(url): """ Helper to convert the httpx.URL parts from bytes to a str """ - scheme, host, port, raw_path = url.raw + # httpx==0.23.1 removed URL.raw, must construct it manually + if HTTPX_VERSION >= (0, 23, 1): + scheme = url.raw_scheme + host = url.raw_host + port = url.port + raw_path = url.raw_path + else: + scheme, host, port, raw_path = url.raw url = scheme + b"://" + host if port is not None: url += b":" + ensure_binary(str(port)) diff --git a/riotfile.py b/riotfile.py index 39e38fe5150..34c970b2585 100644 --- a/riotfile.py +++ b/riotfile.py @@ -1716,7 +1716,7 @@ def select_pys(min_version=MIN_PYTHON_VERSION, max_version=MAX_PYTHON_VERSION): "~=0.16.0", "~=0.17.0", "~=0.18.0", - "<1.0.0", + "~=0.22.0", latest, ], },