diff --git a/ddtrace/contrib/httpx/patch.py b/ddtrace/contrib/httpx/patch.py index b5d1352beb5..cf869b4740c 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", { @@ -38,7 +40,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 ad76d3fe06e..ea1b0b01fd0 100644 --- a/riotfile.py +++ b/riotfile.py @@ -1622,7 +1622,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, ], },