|
1 | 1 | from _typeshed import Self, SupportsItems, SupportsRead |
2 | 2 | from collections.abc import Callable, Iterable, Mapping, MutableMapping |
3 | | -from typing import IO, Any, Union |
| 3 | +from typing import Any, Union |
4 | 4 | from typing_extensions import TypeAlias, TypedDict |
5 | 5 |
|
6 | 6 | from urllib3._collections import RecentlyUsedContainer |
@@ -45,7 +45,25 @@ class SessionRedirectMixin: |
45 | 45 | def rebuild_proxies(self, prepared_request, proxies): ... |
46 | 46 | def should_strip_auth(self, old_url, new_url): ... |
47 | 47 |
|
48 | | -_Data: TypeAlias = str | bytes | Mapping[str, Any] | Iterable[tuple[str, str | None]] | IO[Any] |
| 48 | +_Data: TypeAlias = ( |
| 49 | + # used in requests.models.PreparedRequest.prepare_body |
| 50 | + # |
| 51 | + # case: is_stream |
| 52 | + # see requests.adapters.HTTPAdapter.send |
| 53 | + # will be sent directly to http.HTTPConnection.send(...) (through urllib3) |
| 54 | + Iterable[bytes] |
| 55 | + # case: not is_stream |
| 56 | + # will be modified before being sent to urllib3.HTTPConnectionPool.urlopen(body=...) |
| 57 | + # see requests.models.RequestEncodingMixin._encode_params |
| 58 | + # see requests.models.RequestEncodingMixin._encode_files |
| 59 | + # note that keys&values are converted from Any to str by urllib.parse.urlencode |
| 60 | + | str |
| 61 | + | bytes |
| 62 | + | SupportsRead[str | bytes] |
| 63 | + | list[tuple[Any, Any]] |
| 64 | + | tuple[tuple[Any, Any], ...] |
| 65 | + | Mapping[Any, Any] |
| 66 | +) |
49 | 67 | _Auth: TypeAlias = Union[tuple[str, str], _auth.AuthBase, Callable[[PreparedRequest], PreparedRequest]] |
50 | 68 | _Cert: TypeAlias = Union[str, tuple[str, str]] |
51 | 69 | # Files is passed to requests.utils.to_key_val_list() |
|
0 commit comments