Skip to content

Commit 205977a

Browse files
committed
Upgrade requests to 2.32.4
1 parent 7117579 commit 205977a

File tree

7 files changed

+27
-22
lines changed

7 files changed

+27
-22
lines changed

news/requests.vendor.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Upgrade requests to 2.32.4

src/pip/_vendor/requests/__version__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
__title__ = "requests"
66
__description__ = "Python HTTP for Humans."
77
__url__ = "https://requests.readthedocs.io"
8-
__version__ = "2.32.3"
9-
__build__ = 0x023203
8+
__version__ = "2.32.4"
9+
__build__ = 0x023204
1010
__author__ = "Kenneth Reitz"
1111
__author_email__ = "[email protected]"
1212
__license__ = "Apache-2.0"

src/pip/_vendor/requests/compat.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@
99

1010
import sys
1111

12+
# -------
13+
# urllib3
14+
# -------
15+
from pip._vendor.urllib3 import __version__ as urllib3_version
16+
17+
# Detect which major version of urllib3 is being used.
18+
try:
19+
is_urllib3_1 = int(urllib3_version.split(".")[0]) == 1
20+
except (TypeError, AttributeError):
21+
# If we can't discern a version, prefer old functionality.
22+
is_urllib3_1 = True
23+
1224
# -------------------
1325
# Character Detection
1426
# -------------------

src/pip/_vendor/requests/models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,9 @@ def text(self):
945945
return content
946946

947947
def json(self, **kwargs):
948-
r"""Returns the json-encoded content of a response, if any.
948+
r"""Decodes the JSON response body (if any) as a Python object.
949+
950+
This may return a dictionary, list, etc. depending on what is in the response.
949951
950952
:param \*\*kwargs: Optional arguments that ``json.loads`` takes.
951953
:raises requests.exceptions.JSONDecodeError: If the response body does not

src/pip/_vendor/requests/utils.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
getproxies,
3939
getproxies_environment,
4040
integer_types,
41+
is_urllib3_1,
4142
)
4243
from .compat import parse_http_list as _parse_list_header
4344
from .compat import (
@@ -136,7 +137,9 @@ def super_len(o):
136137
total_length = None
137138
current_position = 0
138139

139-
if isinstance(o, str):
140+
if not is_urllib3_1 and isinstance(o, str):
141+
# urllib3 2.x+ treats all strings as utf-8 instead
142+
# of latin-1 (iso-8859-1) like http.client.
140143
o = o.encode("utf-8")
141144

142145
if hasattr(o, "__len__"):
@@ -216,14 +219,7 @@ def get_netrc_auth(url, raise_errors=False):
216219
netrc_path = None
217220

218221
for f in netrc_locations:
219-
try:
220-
loc = os.path.expanduser(f)
221-
except KeyError:
222-
# os.path.expanduser can fail when $HOME is undefined and
223-
# getpwuid fails. See https://bugs.python.org/issue20164 &
224-
# https://github.com/psf/requests/issues/1846
225-
return
226-
222+
loc = os.path.expanduser(f)
227223
if os.path.exists(loc):
228224
netrc_path = loc
229225
break
@@ -233,13 +229,7 @@ def get_netrc_auth(url, raise_errors=False):
233229
return
234230

235231
ri = urlparse(url)
236-
237-
# Strip port numbers from netloc. This weird `if...encode`` dance is
238-
# used for Python 3.2, which doesn't support unicode literals.
239-
splitstr = b":"
240-
if isinstance(url, str):
241-
splitstr = splitstr.decode("ascii")
242-
host = ri.netloc.split(splitstr)[0]
232+
host = ri.hostname
243233

244234
try:
245235
_netrc = netrc(netrc_path).authenticators(host)

src/pip/_vendor/vendor.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ msgpack==1.1.1
55
packaging==25.0
66
platformdirs==4.3.8
77
pyproject-hooks==1.2.0
8-
requests==2.32.3
8+
requests==2.32.4
99
certifi==2025.6.15
1010
idna==3.10
1111
urllib3==1.26.20

tools/vendoring/patches/requests.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ index 17ca75eda..ddbb6150d 100644
127127
-import importlib
128128
import sys
129129

130-
# -------------------
131-
@@ -18,12 +17,6 @@ import sys
130+
# -------
131+
@@ -30,12 +29,6 @@ import sys
132132
def _resolve_char_detection():
133133
"""Find supported character detection libraries."""
134134
chardet = None

0 commit comments

Comments
 (0)