requests: Annotate Session.merge_environment_settings (#8313)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
David Hotham
2022-07-18 19:54:48 +01:00
committed by GitHub
parent 341057105f
commit 6873a78b6b

View File

@@ -1,7 +1,7 @@
from _typeshed import Self, SupportsItems, SupportsRead
from collections.abc import Callable, Iterable, Mapping, MutableMapping
from typing import IO, Any, Union
from typing_extensions import TypeAlias
from typing_extensions import TypeAlias, TypedDict
from urllib3._collections import RecentlyUsedContainer
@@ -75,6 +75,12 @@ _HeadersUpdateMapping: TypeAlias = Mapping[str, str | bytes | None]
_Timeout: TypeAlias = Union[float, tuple[float, float], tuple[float, None]]
_Verify: TypeAlias = bool | str
class _Settings(TypedDict):
verify: _Verify | None
proxies: _TextMapping
stream: bool
cert: _Cert | None
class Session(SessionRedirectMixin):
__attrs__: Any
headers: CaseInsensitiveDict[str | bytes]
@@ -86,8 +92,8 @@ class Session(SessionRedirectMixin):
hooks: dict[str, list[_Hook] | Any]
params: _Params
stream: bool
verify: None | bool | str
cert: None | str | tuple[str, str]
verify: _Verify | None
cert: _Cert | None
max_redirects: int
trust_env: bool
cookies: RequestsCookieJar
@@ -261,7 +267,14 @@ class Session(SessionRedirectMixin):
allow_redirects: bool = ...,
**kwargs: Any,
) -> Response: ...
def merge_environment_settings(self, url, proxies, stream, verify, cert): ...
def merge_environment_settings(
self,
url: str | bytes | None,
proxies: _TextMapping | None,
stream: bool | None,
verify: _Verify | None,
cert: _Cert | None,
) -> _Settings: ...
def get_adapter(self, url: str) -> _BaseAdapter: ...
def close(self) -> None: ...
def mount(self, prefix: str | bytes, adapter: _BaseAdapter) -> None: ...