Skip to content

Commit b4069c3

Browse files
authored
Merge branch 'psf:main' into fix-ipv6-parsing
2 parents ff78b0f + 91a3eab commit b4069c3

File tree

19 files changed

+258
-99
lines changed

19 files changed

+258
-99
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545

4646
# Initializes the CodeQL tools for scanning.
4747
- name: Initialize CodeQL
48-
uses: github/codeql-action/init@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3.28.5
48+
uses: github/codeql-action/init@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
4949
with:
5050
languages: "python"
5151
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -56,7 +56,7 @@ jobs:
5656
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5757
# If this step fails, then you should remove it and run the build manually (see below)
5858
- name: Autobuild
59-
uses: github/codeql-action/autobuild@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3.28.5
59+
uses: github/codeql-action/autobuild@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
6060

6161
# ℹ️ Command-line programs to run using the OS shell.
6262
# 📚 https://git.io/JvXDl
@@ -70,4 +70,4 @@ jobs:
7070
# make release
7171

7272
- name: Perform CodeQL Analysis
73-
uses: github/codeql-action/analyze@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3.28.5
73+
uses: github/codeql-action/analyze@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ permissions:
77

88
jobs:
99
lint:
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-24.04
1111
timeout-minutes: 10
1212

1313
steps:
1414
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
1515
- name: Set up Python
16-
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
16+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
1717
with:
1818
python-version: "3.x"
1919
- name: Run pre-commit

.github/workflows/publish.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
build:
13+
name: "Build dists"
14+
runs-on: "ubuntu-latest"
15+
environment:
16+
name: "publish"
17+
outputs:
18+
hashes: ${{ steps.hash.outputs.hashes }}
19+
20+
steps:
21+
- name: Harden the runner (Audit all outbound calls)
22+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
23+
with:
24+
egress-policy: audit
25+
26+
- name: "Checkout repository"
27+
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683"
28+
29+
- name: "Setup Python"
30+
uses: "actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065"
31+
with:
32+
python-version: "3.x"
33+
34+
- name: "Install dependencies"
35+
run: python -m pip install build==0.8.0
36+
37+
- name: "Build dists"
38+
run: |
39+
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) \
40+
python -m build
41+
42+
- name: "Generate hashes"
43+
id: hash
44+
run: |
45+
cd dist && echo "::set-output name=hashes::$(sha256sum * | base64 -w0)"
46+
47+
- name: "Upload dists"
48+
uses: "actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02"
49+
with:
50+
name: "dist"
51+
path: "dist/"
52+
if-no-files-found: error
53+
retention-days: 5
54+
55+
provenance:
56+
needs: [build]
57+
permissions:
58+
actions: read
59+
contents: write
60+
id-token: write # Needed to access the workflow's OIDC identity.
61+
uses: "slsa-framework/slsa-github-generator/.github/workflows/[email protected]"
62+
with:
63+
base64-subjects: "${{ needs.build.outputs.hashes }}"
64+
upload-assets: true
65+
compile-generator: true # Workaround for https://github.com/slsa-framework/slsa-github-generator/issues/1163
66+
67+
publish:
68+
name: "Publish"
69+
if: startsWith(github.ref, 'refs/tags/')
70+
needs: ["build", "provenance"]
71+
permissions:
72+
contents: write
73+
id-token: write
74+
runs-on: "ubuntu-latest"
75+
76+
steps:
77+
- name: Harden the runner (Audit all outbound calls)
78+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
79+
with:
80+
egress-policy: audit
81+
82+
- name: "Download dists"
83+
uses: "actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093"
84+
with:
85+
name: "dist"
86+
path: "dist/"
87+
88+
- name: "Publish dists to PyPI"
89+
uses: "pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc"

.github/workflows/run-tests.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.9", "pypy-3.10"]
15+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.10", "pypy-3.11"]
1616
os: [ubuntu-22.04, macOS-latest, windows-latest]
17+
# Pypy-3.11 can't install openssl-sys with rust
18+
# which prevents us from testing in GHA.
19+
exclude:
20+
- { python-version: "pypy-3.11", os: "windows-latest" }
1721

1822
steps:
1923
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
2024
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
25+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
2226
with:
2327
python-version: ${{ matrix.python-version }}
2428
cache: 'pip'
@@ -39,7 +43,7 @@ jobs:
3943
steps:
4044
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
4145
- name: 'Set up Python 3.8'
42-
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55
46+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
4347
with:
4448
python-version: '3.8'
4549
- name: Install dependencies
@@ -59,7 +63,7 @@ jobs:
5963
steps:
6064
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
6165
- name: 'Set up Python 3.8'
62-
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55
66+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
6367
with:
6468
python-version: '3.8'
6569
- name: Install dependencies

HISTORY.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@ dev
66

77
- \[Short description of non-trivial change.\]
88

9+
2.32.4 (2025-06-10)
10+
-------------------
11+
12+
**Security**
13+
- CVE-2024-47081 Fixed an issue where a maliciously crafted URL and trusted
14+
environment will retrieve credentials for the wrong hostname/machine from a
15+
netrc file.
16+
17+
**Improvements**
18+
- Numerous documentation improvements
19+
20+
**Deprecations**
21+
- Added support for pypy 3.11 for Linux and macOS.
22+
- Dropped support for pypy 3.9 following its end of support.
23+
24+
925
2.32.3 (2024-05-29)
1026
-------------------
1127

Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ flake8:
1616
coverage:
1717
python -m pytest --cov-config .coveragerc --verbose --cov-report term --cov-report xml --cov=src/requests tests
1818

19-
publish:
20-
python -m pip install 'twine>=1.5.0'
21-
python setup.py sdist bdist_wheel
22-
twine upload dist/*
19+
.publishenv:
20+
python -m venv .publishenv
21+
.publishenv/bin/pip install 'twine>=1.5.0' build
22+
23+
publish: .publishenv
24+
.publishenv/bin/python -m build
25+
.publishenv/bin/python -m twine upload --skip-existing dist/*
2326
rm -fr build dist .egg requests.egg-info
2427

2528
docs:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Requests is ready for the demands of building robust and reliable HTTP–speakin
6060
## Cloning the repository
6161

6262
When cloning the Requests repository, you may need to add the `-c
63-
fetch.fsck.badTimezone=ignore` flag to avoid an error about a bad commit (see
63+
fetch.fsck.badTimezone=ignore` flag to avoid an error about a bad commit timestamp (see
6464
[this issue](https://github.com/psf/requests/issues/2690) for more background):
6565

6666
```shell

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
# General information about the project.
6060
project = u"Requests"
61-
copyright = u'MMXVIX. A <a href="https://kenreitz.org/projects">Kenneth Reitz</a> Project'
61+
copyright = u'MMXVIX. A Kenneth Reitz Project'
6262
author = u"Kenneth Reitz"
6363

6464
# The version info for the project you're documenting, acts as replacement for

docs/dev/contributing.rst

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,17 @@ The guide is split into sections based on the type of contribution you're
2222
thinking of making, with a section that covers general guidelines for all
2323
contributors.
2424

25-
Be Cordial
26-
----------
25+
Code of Conduct
26+
---------------
2727

28-
**Be cordial or be on your way**. *—Kenneth Reitz*
28+
The Python community is made up of members from around the globe with a diverse
29+
set of skills, personalities, and experiences. It is through these differences
30+
that our community experiences great successes and continued growth. When you're
31+
working with members of the community, follow the
32+
`Python Software Foundation Code of Conduct`_ to help steer your interactions
33+
and keep Python a positive, successful, and growing community.
2934

30-
Requests has one very important rule governing all forms of contribution,
31-
including reporting bugs or requesting features. This golden rule is
32-
"`be cordial or be on your way`_".
33-
34-
**All contributions are welcome**, as long as
35-
everyone involved is treated with respect.
36-
37-
.. _be cordial or be on your way: https://kenreitz.org/essays/2013/01/27/be-cordial-or-be-on-your-way
35+
.. _Python Software Foundation Code of Conduct: https://policies.python.org/python.org/code-of-conduct/
3836

3937
.. _early-feedback:
4038

docs/user/advanced.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -969,11 +969,9 @@ Requests will automatically parse these link headers and make them easily consum
969969
Transport Adapters
970970
------------------
971971

972-
As of v1.0.0, Requests has moved to a modular internal design. Part of the
973-
reason this was done was to implement Transport Adapters, originally
974-
`described here`_. Transport Adapters provide a mechanism to define interaction
975-
methods for an HTTP service. In particular, they allow you to apply per-service
976-
configuration.
972+
As of v1.0.0, Requests has moved to a modular internal design using Transport
973+
Adapters. These objects provide a mechanism to define interaction methods for an
974+
HTTP service. In particular, they allow you to apply per-service configuration.
977975

978976
Requests ships with a single Transport Adapter, the :class:`HTTPAdapter
979977
<requests.adapters.HTTPAdapter>`. This adapter provides the default Requests
@@ -1053,7 +1051,6 @@ backoff, within a Requests :class:`Session <requests.Session>` using the
10531051
)
10541052
s.mount('https://', HTTPAdapter(max_retries=retries))
10551053

1056-
.. _`described here`: https://kenreitz.org/essays/2012/06/14/the-future-of-python-http
10571054
.. _`urllib3`: https://github.com/urllib3/urllib3
10581055
.. _`urllib3.util.Retry`: https://urllib3.readthedocs.io/en/stable/reference/urllib3.util.html#urllib3.util.Retry
10591056

docs/user/authentication.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ set with `headers=`.
4444
If credentials for the hostname are found, the request is sent with HTTP Basic
4545
Auth.
4646

47+
Requests will search for the netrc file at `~/.netrc`, `~/_netrc`, or at the path
48+
specified by the `NETRC` environment variable. `~` denotes the user's home
49+
directory, which is `$HOME` on Unix based systems and `%USERPROFILE%` on Windows.
50+
51+
Usage of netrc file can be disabled by setting `trust_env` to `False` in the
52+
Requests session::
53+
54+
>>> s = requests.Session()
55+
>>> s.trust_env = False
56+
>>> s.get('https://httpbin.org/basic-auth/user/pass')
4757

4858
Digest Authentication
4959
---------------------

docs/user/quickstart.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ Note: Custom headers are given less precedence than more specific sources of inf
222222
are specified in ``.netrc``, which in turn will be overridden by the ``auth=``
223223
parameter. Requests will search for the netrc file at `~/.netrc`, `~/_netrc`,
224224
or at the path specified by the `NETRC` environment variable.
225+
Check details in :ref:`netrc authentication <authentication>`.
225226
* Authorization headers will be removed if you get redirected off-host.
226227
* Proxy-Authorization headers will be overridden by proxy credentials provided in the URL.
227228
* Content-Length headers will be overridden when we can determine the length of the content.

src/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"

0 commit comments

Comments
 (0)