Skip to content

Commit 372b541

Browse files
garrettheelJelleZijlstra
authored andcommitted
Fix requests session hooks type (#1794)
1 parent 6d7173b commit 372b541

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

third_party/2and3/requests/sessions.pyi

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Stubs for requests.sessions (Python 3)
22

3-
from typing import Any, Union, MutableMapping, Text, Optional, IO, Tuple, Callable
3+
from typing import Any, Union, List, MutableMapping, Text, Optional, IO, Tuple, Callable, Iterable
44
from . import adapters
55
from . import auth as _auth
66
from . import compat
@@ -56,7 +56,10 @@ class SessionRedirectMixin:
5656
def rebuild_proxies(self, prepared_request, proxies): ...
5757

5858
_Data = Union[None, bytes, MutableMapping[Text, Text], IO]
59-
_Hooks = MutableMapping[Text, Callable[[Response], Any]]
59+
60+
_Hook = Callable[[Response], Any]
61+
_Hooks = MutableMapping[Text, List[_Hook]]
62+
_HooksInput = MutableMapping[Text, Union[Iterable[_Hook], _Hook]]
6063

6164
class Session(SessionRedirectMixin):
6265
__attrs__ = ... # type: Any
@@ -87,7 +90,7 @@ class Session(SessionRedirectMixin):
8790
timeout: Union[None, float, Tuple[float, float]] = ...,
8891
allow_redirects: Optional[bool] = ...,
8992
proxies: Optional[MutableMapping[Text, Text]] = ...,
90-
hooks: Optional[_Hooks] = ...,
93+
hooks: Optional[_HooksInput] = ...,
9194
stream: Optional[bool] = ...,
9295
verify: Union[None, bool, Text] = ...,
9396
cert: Union[Text, Tuple[Text, Text], None] = ...,

0 commit comments

Comments
 (0)