Tom Milligan
51f97dda15
requests: expand types for files ( #7999 )
2022-06-01 22:55:38 +03:00
Alex Waygood
fa636bc044
Third-party stubs: fix several fictitious type aliases ( #7958 )
2022-05-26 06:26:26 -07:00
Akuli
f77d0f80a8
requests: allow immutable headers ( #7932 )
2022-05-25 20:22:05 -07:00
Akuli
9a09db46f5
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`.
2022-05-18 19:31:34 -07:00
Alejandro Giacometti
87abd8a39f
requests: Fix type of request headers (#7773 )
...
Allow bytes values. In `Session` methods, `None` can be used to ignore the session's headers.
2022-05-16 23:33:46 +03:00
Akuli
e613fc483b
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.
2022-04-29 20:53:01 +01:00
Milan Boers
f330e12f3e
requests: allow non-mutable Mapping for files/hooks parameters ( #7732 )
2022-04-28 08:40:53 -06:00
Milan Boers
df06044ee8
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
2022-04-28 02:19:57 -06:00
Alec Rosenbaum
63fb9af743
requests: Add None to a type alias ( #7721 )
...
Fixes #7720
2022-04-27 08:39:15 -06:00
Milan Boers
ae09e4e866
Add more typing hints for requests ( #7696 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com >
Co-authored-by: Akuli <akuviljanen17@gmail.com >
2022-04-27 14:40:20 +03:00
Alex Waygood
b093c90a94
Use TypeAlias for type aliases where possible, part II ( #7667 )
2022-04-20 20:02:47 +01:00
Alex Waygood
653f2c6ba4
Third-party stubs: import from collections.abc where possible ( #7637 )
2022-04-16 14:52:57 +01:00
Alex Waygood
66bea8ca48
Use imports instead of TypeAliases in a couple places ( #7634 )
...
Fixes #7632
2022-04-16 01:38:59 -07:00
Alex Waygood
740193a8fc
Use TypeAlias where possible for type aliases ( #7630 )
2022-04-15 18:01:00 -07:00
Alex Waygood
c0e6dd3f3f
Use str instead of typing.Text ( #7629 )
2022-04-16 00:47:42 +02:00
Alex Waygood
ec27c00ca2
Third-party stubs: Improve several __exit__ methods ( #7575 )
2022-04-01 08:03:12 -07:00
Kalle Møller
9aa64fdc22
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
2022-03-26 20:41:25 -07:00
Jelle Zijlstra
b7d129f727
PEP 604: Remove some more uses of Union/Optional ( #7515 )
...
The following patterns still break mypy:
1. `type[]` at top level fails
2. `tuple[T1, T2]` at top level fails (but `tuple[T1, ...]` is fine)
3. `T1 | Callable[..., T2 | T3]` fails, but only <=3.9
This PR cleans up usage of `Union` and `Optional` outside these patterns.
2022-03-19 08:23:00 -07:00
Alex Waygood
3ab250eec8
Use PEP 604 syntax wherever possible ( #7493 )
2022-03-16 16:01:33 +01:00
Alex Waygood
8134752ad8
requests stubs are not Python 2-compatible (#7483 )
2022-03-13 13:06:34 +01:00
Alex Waygood
64af11c78f
Correct several positional-only differences in third-party stubs ( #7352 )
2022-02-22 06:49:51 -08:00
Alex Waygood
1341a34525
Remove unused allowlist entries in babel and requests ( #7233 )
2022-02-15 16:26:13 -08:00
DataGhost
7bb6ce7083
Added missing import for JSONDecodeError ( #7171 )
...
Co-authored-by: DataGhost <git@dataghost.com >
2022-02-09 11:31:55 -08:00
UncleOwen
8631ed9e57
requests.Session: Accept hooks and lists of hooks ( #7094 )
2022-01-31 11:29:05 +01:00
Akuli
df0fe16456
requests: remove an unused allowlist entry ( #6911 )
2022-01-13 20:35:37 +01:00
Akuli
423ae7f8fd
requests: Remove an unused allowlist entry ( #6897 )
2022-01-12 00:53:43 -08:00
Alex Waygood
96c9abb058
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: 79ec7b2826/src/filelock/_api.py (L207)
* Improve `opentracing/scope` annotation
Source code here: 3e1d357a34/opentracing/scope.py (L71)
* Improve `redis/client` stub
Source code here: 15f315a496/redis/client.py (L1217)
* Improve `redis/lock` annotation
Source code here: 15f315a496/redis/lock.py (L155)
* Improve `requests/models` annotation
Source code here: d718e75383/requests/models.py (L653)
2022-01-09 19:16:19 -08:00
Alex Waygood
3351f0c0b9
Remove unused requests allowlist entry ( #6882 )
2022-01-10 00:18:23 +01:00
Alex Waygood
a40d79a4e6
Use lowercase type everywhere ( #6853 )
2022-01-08 16:09:29 +01:00
Sebastian Rittau
f8501d33c7
Use types-urllib3 for requests ( #6859 )
2022-01-08 16:25:50 +02:00
Sebastian Rittau
e77a66aced
Update pyright ( #6840 )
2022-01-07 18:58:15 +02:00
Ambrose Chua
032e6ee90c
requests: Add JSONDecodeError ( #6838 )
2022-01-06 19:34:22 -08:00
Alex Waygood
8d5d2520ac
Use PEP 585 syntax wherever possible ( #6717 )
2021-12-28 11:31:43 +01:00
Shantanu
2ad00c9664
Use stubtest 0.920 ( #6589 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com >
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
Co-authored-by: Sebastian Rittau <srittau@rittau.biz >
Co-authored-by: Akuli <akuviljanen17@gmail.com >
2021-12-17 13:58:11 +02:00
Akuli
a5bc1e037f
Add mypy error codes to '# type: ignore' comments ( #6379 )
2021-11-26 07:07:56 +01:00
Sebastian Rittau
2679ed1c07
Add some kwonly arguments to Session.send() ( #6266 )
...
Bump version to 2.26
2021-11-09 17:23:48 -08:00
KotlinIsland
6e646f43dd
Remove BaseAdapter from requests.sessions ( #6264 )
2021-11-08 17:33:16 -08:00
Akuli
994b69ef8f
Use lowercase tuple where possible ( #6170 )
2021-10-14 17:18:19 -07:00
Sebastian Rittau
9f86972350
Add star to all non-0.1 versions ( #6146 )
2021-10-11 13:41:19 -07:00
Sebastian Rittau
3128c6afbf
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.
2021-09-25 11:50:36 +03:00
Matthew Hughes
d1a556cec9
Update Session.prepare_request, .get_adapter ( #6058 )
2021-09-21 19:15:45 +02:00
Edgar Ramírez
8ea6d6f331
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 .
2021-09-20 06:46:22 -07:00
Akuli
191aac3b0e
lowercase list and dict for 3rd party stubs ( #5893 )
...
* stubs/decorator/decorator.pyi
* stubs/frozendict/frozendict.pyi
* stubs/Jinja2/jinja2/nodes.pyi
* stubs/Pygments/pygments/token.pyi
* stubs/requests/requests/models.pyi
* stubs/Werkzeug/werkzeug/http.pyi
2021-08-08 13:25:18 -07:00
Akuli
ce11072dbe
Big diff: use lower-case list and dict ( #5888 )
2021-08-08 09:26:35 -07:00
Akuli
1154218a0e
switch to new union syntax in third-party stubs ( #5881 )
2021-08-08 15:46:55 +02:00
Akuli
ee487304d7
Big diff: Use new "|" union syntax ( #5872 )
2021-08-08 11:05:21 +02:00
Stephen Rosen
6a9c7aff99
Add missing exceptions to requests __init__.pyi ( #5840 )
2021-08-02 07:29:28 -07:00
MapleCCC
7ce0b9d670
Update urllib3.util.retry.Retry.__init__() to match the latest version released on PyPI ( #5817 )
2021-07-29 20:35:24 -07:00
Sebastian Rittau
b1ef60c9d5
Update a few stub versions ( #5670 )
2021-06-21 07:15:00 -07:00
Sebastian Rittau
9ec2f87124
Copy args from json.loads() to requests.Response.json() ( #5664 )
2021-06-20 07:21:20 -07:00