Skip to content

requests: add more accurate stubs for certain fields of the Session object #1504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion third_party/2and3/requests/auth.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Any, Text, Union
from . import compat
from . import cookies
from . import models
from . import utils
from . import status_codes

Expand All @@ -17,7 +18,7 @@ CONTENT_TYPE_MULTI_PART = ... # type: Any
def _basic_auth_str(username: Union[bytes, Text], password: Union[bytes, Text]) -> str: ...

class AuthBase:
def __call__(self, r): ...
def __call__(self, r: models.Request) -> models.Request: ...

class HTTPBasicAuth(AuthBase):
username = ... # type: Any
Expand Down
10 changes: 5 additions & 5 deletions third_party/2and3/requests/sessions.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Any, Union, MutableMapping, Text, Optional, IO, Tuple, Callable
from . import adapters
from . import auth
from . import auth as _auth
from . import compat
from . import cookies
from . import models
Expand Down Expand Up @@ -61,12 +61,12 @@ _Hooks = MutableMapping[Text, Callable[[Response], Any]]
class Session(SessionRedirectMixin):
__attrs__ = ... # type: Any
headers = ... # type: MutableMapping[Text, Text]
auth = ... # type: Union[None, Tuple[Text, Text], Callable[[Request], Request]]
auth = ... # type: Union[None, Tuple[Text, Text], _auth.AuthBase, Callable[[Request], Request]]
proxies = ... # type: MutableMapping[Text, Text]
hooks = ... # type: _Hooks
params = ... # type: Union[bytes, MutableMapping[Text, Text]]
stream = ... # type: bool
verify = ... # type: bool
verify = ... # type: Union[None, bool, Text]
cert = ... # type: Union[None, Text, Tuple[Text, Text]]
max_redirects = ... # type: int
trust_env = ... # type: bool
Expand All @@ -83,13 +83,13 @@ class Session(SessionRedirectMixin):
headers: Optional[MutableMapping[Text, Text]] = ...,
cookies: Union[None, RequestsCookieJar, MutableMapping[Text, Text]] = ...,
files: Optional[MutableMapping[Text, IO]] = ...,
auth: Union[None, Tuple[Text, Text], Callable[[Request], Request]] = ...,
auth: Union[None, Tuple[Text, Text], _auth.AuthBase, Callable[[Request], Request]] = ...,
timeout: Union[None, float, Tuple[float, float]] = ...,
allow_redirects: Optional[bool] = ...,
proxies: Optional[MutableMapping[Text, Text]] = ...,
hooks: Optional[_Hooks] = ...,
stream: Optional[bool] = ...,
verify: Optional[bool] = ...,
verify: Union[None, bool, Text] = ...,
cert: Union[Text, Tuple[Text, Text], None] = ...,
json: Optional[MutableMapping] = ...,
) -> Response: ...
Expand Down