Skip to content

Commit fcbb142

Browse files
authored
[requests] Update to 2.32.3 (#12060)
1 parent 9908f60 commit fcbb142

File tree

2 files changed

+43
-23
lines changed

2 files changed

+43
-23
lines changed

stubs/requests/requests/adapters.pyi

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
from _typeshed import Incomplete
22
from collections.abc import Mapping
3-
from typing_extensions import deprecated
3+
from ssl import SSLContext
4+
from typing import Literal, TypedDict
5+
from typing_extensions import NotRequired, deprecated
46

7+
import urllib3
58
from urllib3.connectionpool import ConnectionPool
69
from urllib3.contrib.socks import SOCKSProxyManager as SOCKSProxyManager
710
from urllib3.exceptions import (
@@ -34,6 +37,20 @@ from .utils import (
3437
urldefragauth as urldefragauth,
3538
)
3639

40+
# Arguments to urllib3 connection_from_host() functions (except pool_kwargs).
41+
class _HostParams(TypedDict):
42+
host: str
43+
scheme: str
44+
port: int
45+
46+
class _PoolKwargs(TypedDict):
47+
ssl_context: NotRequired[SSLContext]
48+
ca_certs: NotRequired[str]
49+
ca_cert_dir: NotRequired[str]
50+
cert_reqs: Literal["CERT_REQUIRED", "CERT_NONE"]
51+
cert_file: NotRequired[str]
52+
key_file: NotRequired[str]
53+
3754
DEFAULT_POOLBLOCK: bool
3855
DEFAULT_POOLSIZE: int
3956
DEFAULT_RETRIES: int
@@ -64,7 +81,10 @@ class HTTPAdapter(BaseAdapter):
6481
def init_poolmanager(self, connections, maxsize, block=False, **pool_kwargs): ...
6582
def proxy_manager_for(self, proxy, **proxy_kwargs): ...
6683
def cert_verify(self, conn, url, verify, cert): ...
67-
def build_response(self, req, resp): ...
84+
def build_response(self, req: PreparedRequest, resp: urllib3.BaseHTTPResponse) -> Response: ...
85+
def build_connection_pool_key_attributes(
86+
self, request: PreparedRequest, verify: bool | str, cert: str | tuple[str, str] | None = None
87+
) -> tuple[_HostParams, _PoolKwargs]: ...
6888
def get_connection_with_tls_context(
6989
self,
7090
request: PreparedRequest,

stubs/requests/requests/models.pyi

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import datetime
2-
from _typeshed import Unused
2+
from _typeshed import Incomplete, Unused
33
from collections.abc import Callable, Iterator
44
from json import JSONDecoder
55
from typing import Any
@@ -41,10 +41,10 @@ super_len = utils.super_len
4141
to_native_string = utils.to_native_string
4242
codes = status_codes.codes
4343

44-
REDIRECT_STATI: Any
45-
DEFAULT_REDIRECT_LIMIT: Any
46-
CONTENT_CHUNK_SIZE: Any
47-
ITER_CHUNK_SIZE: Any
44+
REDIRECT_STATI: Incomplete
45+
DEFAULT_REDIRECT_LIMIT: Incomplete
46+
CONTENT_CHUNK_SIZE: Incomplete
47+
ITER_CHUNK_SIZE: Incomplete
4848

4949
class RequestEncodingMixin:
5050
@property
@@ -55,16 +55,16 @@ class RequestHooksMixin:
5555
def deregister_hook(self, event, hook): ...
5656

5757
class Request(RequestHooksMixin):
58-
hooks: Any
59-
method: Any
60-
url: Any
61-
headers: Any
62-
files: Any
63-
data: Any
64-
json: Any
65-
params: Any
66-
auth: Any
67-
cookies: Any
58+
hooks: Incomplete
59+
method: Incomplete
60+
url: Incomplete
61+
headers: Incomplete
62+
files: Incomplete
63+
data: Incomplete
64+
json: Incomplete
65+
params: Incomplete
66+
auth: Incomplete
67+
cookies: Incomplete
6868
def __init__(
6969
self,
7070
method=None,
@@ -85,7 +85,7 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
8585
url: str | None
8686
headers: CaseInsensitiveDict[str]
8787
body: bytes | str | None
88-
hooks: Any
88+
hooks: Incomplete
8989
def __init__(self) -> None: ...
9090
def prepare(
9191
self,
@@ -111,11 +111,11 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
111111
def prepare_hooks(self, hooks) -> None: ...
112112

113113
class Response:
114-
__attrs__: Any
114+
__attrs__: Incomplete
115115
_content: bytes | None # undocumented
116116
status_code: int
117117
headers: CaseInsensitiveDict[str]
118-
raw: Any
118+
raw: Incomplete
119119
url: str
120120
encoding: str | None
121121
history: list[Response]
@@ -139,10 +139,10 @@ class Response:
139139
def is_permanent_redirect(self) -> bool: ...
140140
@property
141141
def apparent_encoding(self) -> str: ...
142-
def iter_content(self, chunk_size: int | None = 1, decode_unicode: bool = False) -> Iterator[Any]: ...
142+
def iter_content(self, chunk_size: int | None = 1, decode_unicode: bool = False) -> Iterator[Incomplete]: ...
143143
def iter_lines(
144144
self, chunk_size: int | None = 512, decode_unicode: bool = False, delimiter: str | bytes | None = None
145-
) -> Iterator[Any]: ...
145+
) -> Iterator[Incomplete]: ...
146146
@property
147147
def content(self) -> bytes: ...
148148
@property
@@ -159,6 +159,6 @@ class Response:
159159
**kwds: Any,
160160
) -> Any: ...
161161
@property
162-
def links(self) -> dict[Any, Any]: ...
162+
def links(self) -> dict[Incomplete, Incomplete]: ...
163163
def raise_for_status(self) -> None: ...
164164
def close(self) -> None: ...

0 commit comments

Comments
 (0)