remove unneeded Iterable base class from CookieJar (#12812)
Correct requests cookies
argument (#12654)
requests: Session.adapters is a mapping of Adapters (#12473)
Signed-off-by: Stephen Finucane [email protected]
Add hint for requests.models.Response.raw (#12616)
requests: Add connection property (type HTTPAdapter) to the Response class (#12279)
The Response
instance is built by HTTPAdapter
. When built, a property called connection
is added to the Response
that points back to the HTTPAdapter
that created it. For example, this is used in the requests
library's HTTPDigestAuth
class to remake requests with credentials after authorization is requested by a server.
requests: Fix Response.content return type to include None (#12180)
[requests] Update to 2.32.3 (#12060)
[requests] Update to 2.32.2 (#12000)
Also replace some Any
annotations with Incomplete
and use Final
in requests.__version__
.
[stubsabot] Bump requests to 2.32.* (#11991)
Release: https://pypi.org/pypi/requests/2.32.1 Homepage: https://requests.readthedocs.io Repository: https://github.com/psf/requests Typeshed stubs: https://github.com/python/typeshed/tree/main/stubs/requests Diff: https://github.com/psf/requests/compare/v2.31.0...v2.32.1
Stubsabot analysis of the diff between the two releases:
- Total lines of Python code added: 486.
- Total lines of Python code deleted: 131.
requests: export packages
and utils
(#11723)
requests: remove a type: ignore
(#11704)
requests: annotate RequestsCookieJar (#11656)
Use PEP 570 syntax in third party stubs (#11554)
Bump mypy to 1.9, add to json.encoder, small fixups (#11549)
Co-authored-by: Alex Waygood [email protected]
requests: Allow passing None header values (#11370)
python/typeshed#7773 changed
requests.session.Session
methods to accept None for header values, but
didn't do quite the same for the functions in requests.api
. I think
this was a mistake. The functions in requests.api
just pass through
the headers
argument without doing anything in particular to it.
Furthermore, it's useful to be able to pass None as a header value:
because requests.utils.default_headers
sets an Accept-Encoding
header by default, the easiest way to send a request with no
Accept-Encoding
header is something like requests.get(url, headers={"Accept-Encoding": None})
. It's annoying to have to construct
a Session
just to pass type-checking.
It's a little confusing for the type alias to be called
_HeadersUpdateMapping
in requests.sessions
but _HeadersMapping
in
requests.api
; this is because the latter name was already used in
other type stubs (tensorflow.keras.callbacks
), so it seemed best to
avoid breaking API.
Add parameter type to PreparedRequest.prepare_content_length (#11304)
Update typing_extensions imports in third-party stubs (#11245)
requests: Use the Any
trick in HTTPError
(#11207)
requests: annotate utils.get_encoding_from_headers()
(#10901)
[requests] Allow HTTPError.response to be None (#10875)
This aligns with the definition in requests, but means that user code might
need additional assertions to ensure that HTTPError.response
is not None
.
types-requests
, types-influxdb-client
: add note to the PyPI readme about the urllib3
pin (#10839)
Remove stubs for urllib3
(#10812)
Both types-requests and types-influxdb-client now depend on urllib3>=2 instead of types-urllib3. That in turn means that types-caldav, types-slumber and types-requests-oauthlib all depend indirectly on urllib3>=2, since all three stubs packages depend on types-requests.
[requests] loosen HTTPError constructor (#10776)
[requests] Allow PreparedRequest for RequestException(request=...) (#10767)
[requests] Improve exception class constructors (#10740)
requests: type RequestException members (not Any) (#8989)
Co-authored-by: Alex Waygood [email protected]
Add an upstream_repository field to METADATA.toml (#10487)
Closes: #10478
Allowlist requests.compat.bytes.buffer (#10231)
[stubsabot] Bump requests to 2.31.* (#10199)
Release: https://pypi.org/pypi/requests/2.31.0 Homepage: https://requests.readthedocs.io Diff: https://github.com/psf/requests/compare/v2.30.0...v2.31.0
Stubsabot analysis of the diff between the two releases:
- 0 public Python files have been added.
- 0 files included in typeshed's stubs have been deleted.
- 2 files included in typeshed's stubs have been modified or renamed:
requests/__version__.py
,requests/sessions.py
. - Total lines of Python code added: 26.
- Total lines of Python code deleted: 4.
[requests] Update stubs to 2.30 (#10141)
Update requests
for v2.29 (#10097)
Add defaults for third-party stubs Q-T (#9959)
Add type to requests.models.RequestEncodingMixin.path_url (#9923)
We can see at https://github.com/psf/requests/blob/7f694b79e114c06fac5ec06019cada5a61e5570f/requests/models.py#L104 that this always returns a string.
Improve many __(a)exit__
annotations (#9696)
Stubtest settings: change ignore_missing_stub
default to false
(#9779)
If you're reading about this commit from an autogenerated changelog entry, this should have no user-visible impact on how the stubs are interpreted by a type checker; it's just an internal change to how typeshed's tests work.
Use typing_extensions.Self
instead of _typeshed.Self
(#9702)
Improve pyright verification of third-party test cases in CI (#9650)
Co-authored-by: Avasam [email protected]
Enable flake8-pyi's Y037 (#9686)
Bump mypy to 1.0 (#9684)
Use OSError
instead of IOError
(#9683)
Replace Any
with Incomplete
in many places (#9558)
requests
: set session.headers
to MutableMapping
(#9395)
requests: types for auth username and password (#9389)
Always use bool
and Literal
for Python compat code (#9213)
Annotate known magic-method return types (#9131)
Fix and allow classes with missing metaclasses (#9136)
Mark requests
stubs as complete (#8858)
Co-authored-by: Kevin Kirsche [email protected]
requests
: Add regression test for #8762 (#8835)
The final mypy_primer report for #8762 was an empty diff. Considering the number of issues we've had with our requests stubs over the last year, it feels like it makes sense to add a test case to make sure that it doesn't regress.
requests
: improve _Data
type (#8762)
requests: improve _Data type
This allows to pass an Iterable[bytes] for streaming request data.
Add infrastructure allowing for test cases for third-party stubs (#8700)
- Move the logic for running mypy on the test cases from
tests/mypy_test.py
to a separate script,tests/regr_test.py
. - Add the necessary logic in order to be able to have test cases for third-party stubs.
- Move logic common to
tests/mypy_test.py
andtests/regr_test.py
intotests/colors.py
, and renametests/colors.py
totests/utils.py
. - Add a new check to
tests/check_consistent.py
, to enforce the use of# pyright: reportUnnecessaryTypeIgnoreComment=true
comments in third-party test cases. These are essential if we want to have our tests against false-negatives work with pyright. - Update the relevant documentation to account for the new test file.
- Add a new job to the
tests.yml
GitHub workflow, to run the new test in CI. - Add a simple proof-of-concept test case for
requests
, as a regression test for #7998.
Co-authored-by: Jelle Zijlstra [email protected] Co-authored-by: Sebastian Rittau [email protected]
Support extras in stubtest_third_party.py (#8467)
requests.adapters
: use re-exports rather than assignments (#8485)
Add requests.help
submodule (#8486)
Add requests.__version__
; improve requests.__init__
(#8484)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Alex Waygood [email protected]
requests: fix stubtest (#8463)
Remove or move several TypeAlias
declarations (#8444)
requests: add type hints to requests.utils (#8395)
Co-authored-by: Shantanu [email protected]
Add missing re-exports and vars to requests.compat (#8396)
requests: add annotation for parse_header_links
(#8349)
In the requests package the function utils.parse_header_links()
takes a str as input and returns a list of dictionaries.
This can be seen in the unit tests that are used: https://github.com/psf/requests/blob/786255613bd92f87c9c8f066c4271aab1b9eeaad/tests/test_utils.py#L644-L664
requests
: Annotate Session.merge_environment_settings
(#8313)
Co-authored-by: Alex Waygood [email protected]
Turn requests.requests.packages into a module (#8281)
Remove obsolete class VendorAlias
[stubsabot] Bump requests to 2.28.* (#8152)
Co-authored-by: hauntsaninja <>
requests
, regex
: use re-exports instead of assignments in a few places (#8127)
requests: expand types for files (#7999)
Third-party stubs: fix several fictitious type aliases (#7958)
requests: allow immutable headers (#7932)
Fix requests.Session().hooks (#7871)
Fixes #7776
Mutating hooks, as in session.hooks['response'] = ...
, should work. Reassigning it like session.hooks = ...
is probably a bad idea, so it will always be a dict
.
requests
: Fix type of request headers (#7773)
Allow bytes values. In Session
methods, None
can be used to ignore the session's headers.
Delete python 2 branches from third-party stubs (#7741)
Since #7703, we no longer have third-party stubs that support Python 2, so code like if sys.version_info >= (3, 0)
can be simplified.
requests: allow non-mutable Mapping for files/hooks parameters (#7732)
requests: allow str and bytes for fileobj in files parameter (#7728)
-
requests: allow str and bytes for fileobj in files parameter
-
requests: Use SupportsRead instead of IO for files
requests: Add None to a type alias (#7721)
Fixes #7720
Add more typing hints for requests (#7696)
Co-authored-by: Alex Waygood [email protected] Co-authored-by: Akuli [email protected]
Use TypeAlias
for type aliases where possible, part II (#7667)
Third-party stubs: import from collections.abc
where possible (#7637)
Use imports instead of TypeAliases in a couple places (#7634)
Fixes #7632
Use TypeAlias
where possible for type aliases (#7630)
Use str instead of typing.Text (#7629)
Third-party stubs: Improve several __exit__
methods (#7575)
requests: Update adapters.pyi (#7544)
The cert can be
- A string / bytes which is a path to a certfile
- A tuple with two string / bytes, where the first is the certfile and the second is a keyfile
- None (optional)
The tuple could be anything indexable, but there are strict requirement to actualle have two items, don't know if there is something more generic
See https://github.com/psf/requests/blob/main/requests/adapters.py#L242-L248
PEP 604: Remove some more uses of Union/Optional (#7515)
The following patterns still break mypy:
type[]
at top level failstuple[T1, T2]
at top level fails (buttuple[T1, ...]
is fine)T1 | Callable[..., T2 | T3]
fails, but only <=3.9
This PR cleans up usage of Union
and Optional
outside these patterns.
Use PEP 604 syntax wherever possible (#7493)
requests
stubs are not Python 2-compatible (#7483)
Correct several positional-only differences in third-party stubs (#7352)
Remove unused allowlist entries in babel
and requests
(#7233)
Added missing import for JSONDecodeError (#7171)
Co-authored-by: DataGhost [email protected]
requests.Session: Accept hooks and lists of hooks (#7094)
requests: remove an unused allowlist entry (#6911)
requests: Remove an unused allowlist entry (#6897)
Always use _typeshed.Self
, where applicable (#6880)
-
Always use
_typeshed.Self
, where applicable -
Revert changes to
google-cloud-ndb
(ambiguous) -
Remove empty line added by script
-
Revert changes to
stubs/python-dateutil/dateutil/relativedelta.pyi
-
Manually add a few more that the script missed
-
Improve
filelock
annotation
Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207
- Improve
opentracing/scope
annotation
Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71
- Improve
redis/client
stub
Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217
- Improve
redis/lock
annotation
Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155
- Improve
requests/models
annotation
Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653
Remove unused requests
allowlist entry (#6882)
Use lowercase type
everywhere (#6853)
Use types-urllib3 for requests (#6859)
Update pyright (#6840)
requests: Add JSONDecodeError (#6838)
Use PEP 585 syntax wherever possible (#6717)
Use stubtest 0.920 (#6589)
Co-authored-by: Alex Waygood [email protected] Co-authored-by: Jelle Zijlstra [email protected] Co-authored-by: Sebastian Rittau [email protected] Co-authored-by: Akuli [email protected]
Add mypy error codes to '# type: ignore' comments (#6379)
Add some kwonly arguments to Session.send() (#6266)
Bump version to 2.26
Remove BaseAdapter from requests.sessions (#6264)
Use lowercase tuple where possible (#6170)
Add star to all non-0.1 versions (#6146)
requests: Response.encoding can be None (#6067)
The type of the encoding
attribute was previously typed as str
, even though it can be None
at runtime.
Update Session.prepare_request, .get_adapter (#6058)
Support name, content-type and headers in file upload (#6052)
requests
supports not only passing binary file-like objects for multi-part file uploads but also additionally passing a name, content-type and headers. This adds type hints for those options.
See https://docs.python-requests.org/en/master/user/quickstart/#post-a-multipart-encoded-file.