Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(httpx): manually construct removed URL.raw property #4595

Merged
merged 3 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion ddtrace/contrib/httpx/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
{
Expand All @@ -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
brettlangdon marked this conversation as resolved.
Show resolved Hide resolved
else:
scheme, host, port, raw_path = url.raw
url = scheme + b"://" + host
if port is not None:
url += b":" + ensure_binary(str(port))
Expand Down
2 changes: 1 addition & 1 deletion riotfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1780,7 +1780,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,
],
},
Expand Down