Skip to content

Commit df06044

Browse files
authored
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
1 parent 59c346d commit df06044

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

stubs/requests/requests/sessions.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from _typeshed import Self, SupportsItems
1+
from _typeshed import Self, SupportsItems, SupportsRead
22
from collections.abc import Callable, Iterable, Mapping, MutableMapping
33
from typing import IO, Any, Union
44
from typing_extensions import TypeAlias
@@ -49,10 +49,10 @@ _Data: TypeAlias = str | bytes | Mapping[str, Any] | Iterable[tuple[str, str | N
4949
_Auth: TypeAlias = Union[tuple[str, str], _auth.AuthBase, Callable[[PreparedRequest], PreparedRequest]]
5050
_Cert: TypeAlias = Union[str, tuple[str, str]]
5151
_Files: TypeAlias = (
52-
MutableMapping[str, IO[Any]]
53-
| MutableMapping[str, tuple[str | None, IO[Any]]]
54-
| MutableMapping[str, tuple[str | None, IO[Any], str]]
55-
| MutableMapping[str, tuple[str | None, IO[Any], str, _TextMapping]]
52+
MutableMapping[str, SupportsRead[str | bytes] | str | bytes]
53+
| MutableMapping[str, tuple[str | None, SupportsRead[str | bytes] | str | bytes]]
54+
| MutableMapping[str, tuple[str | None, SupportsRead[str | bytes] | str | bytes, str]]
55+
| MutableMapping[str, tuple[str | None, SupportsRead[str | bytes] | str | bytes, str, _TextMapping]]
5656
)
5757
_Hook: TypeAlias = Callable[[Response], Any]
5858
_Hooks: TypeAlias = MutableMapping[str, _Hook | list[_Hook]]

0 commit comments

Comments
 (0)