Skip to content

[requests] Update to 2.32.3 #12060

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 2 commits into from
Jun 1, 2024
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
24 changes: 22 additions & 2 deletions stubs/requests/requests/adapters.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from _typeshed import Incomplete
from collections.abc import Mapping
from typing_extensions import deprecated
from ssl import SSLContext
from typing import Literal, TypedDict
from typing_extensions import NotRequired, deprecated

import urllib3
from urllib3.connectionpool import ConnectionPool
from urllib3.contrib.socks import SOCKSProxyManager as SOCKSProxyManager
from urllib3.exceptions import (
Expand Down Expand Up @@ -34,6 +37,20 @@ from .utils import (
urldefragauth as urldefragauth,
)

# Arguments to urllib3 connection_from_host() functions (except pool_kwargs).
class _HostParams(TypedDict):
host: str
scheme: str
port: int

class _PoolKwargs(TypedDict):
ssl_context: NotRequired[SSLContext]
ca_certs: NotRequired[str]
ca_cert_dir: NotRequired[str]
cert_reqs: Literal["CERT_REQUIRED", "CERT_NONE"]
cert_file: NotRequired[str]
key_file: NotRequired[str]

DEFAULT_POOLBLOCK: bool
DEFAULT_POOLSIZE: int
DEFAULT_RETRIES: int
Expand Down Expand Up @@ -64,7 +81,10 @@ class HTTPAdapter(BaseAdapter):
def init_poolmanager(self, connections, maxsize, block=False, **pool_kwargs): ...
def proxy_manager_for(self, proxy, **proxy_kwargs): ...
def cert_verify(self, conn, url, verify, cert): ...
def build_response(self, req, resp): ...
def build_response(self, req: PreparedRequest, resp: urllib3.BaseHTTPResponse) -> Response: ...
def build_connection_pool_key_attributes(
self, request: PreparedRequest, verify: bool | str, cert: str | tuple[str, str] | None = None
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the implementation, verify can also be None, but the docstring makes me think that is not desired for this method.

) -> tuple[_HostParams, _PoolKwargs]: ...
def get_connection_with_tls_context(
self,
request: PreparedRequest,
Expand Down
42 changes: 21 additions & 21 deletions stubs/requests/requests/models.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import datetime
from _typeshed import Unused
from _typeshed import Incomplete, Unused
from collections.abc import Callable, Iterator
from json import JSONDecoder
from typing import Any
Expand Down Expand Up @@ -41,10 +41,10 @@ super_len = utils.super_len
to_native_string = utils.to_native_string
codes = status_codes.codes

REDIRECT_STATI: Any
DEFAULT_REDIRECT_LIMIT: Any
CONTENT_CHUNK_SIZE: Any
ITER_CHUNK_SIZE: Any
REDIRECT_STATI: Incomplete
DEFAULT_REDIRECT_LIMIT: Incomplete
CONTENT_CHUNK_SIZE: Incomplete
ITER_CHUNK_SIZE: Incomplete

class RequestEncodingMixin:
@property
Expand All @@ -55,16 +55,16 @@ class RequestHooksMixin:
def deregister_hook(self, event, hook): ...

class Request(RequestHooksMixin):
hooks: Any
method: Any
url: Any
headers: Any
files: Any
data: Any
json: Any
params: Any
auth: Any
cookies: Any
hooks: Incomplete
method: Incomplete
url: Incomplete
headers: Incomplete
files: Incomplete
data: Incomplete
json: Incomplete
params: Incomplete
auth: Incomplete
cookies: Incomplete
def __init__(
self,
method=None,
Expand All @@ -85,7 +85,7 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
url: str | None
headers: CaseInsensitiveDict[str]
body: bytes | str | None
hooks: Any
hooks: Incomplete
def __init__(self) -> None: ...
def prepare(
self,
Expand All @@ -111,11 +111,11 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
def prepare_hooks(self, hooks) -> None: ...

class Response:
__attrs__: Any
__attrs__: Incomplete
_content: bytes | None # undocumented
status_code: int
headers: CaseInsensitiveDict[str]
raw: Any
raw: Incomplete
url: str
encoding: str | None
history: list[Response]
Expand All @@ -139,10 +139,10 @@ class Response:
def is_permanent_redirect(self) -> bool: ...
@property
def apparent_encoding(self) -> str: ...
def iter_content(self, chunk_size: int | None = 1, decode_unicode: bool = False) -> Iterator[Any]: ...
def iter_content(self, chunk_size: int | None = 1, decode_unicode: bool = False) -> Iterator[Incomplete]: ...
def iter_lines(
self, chunk_size: int | None = 512, decode_unicode: bool = False, delimiter: str | bytes | None = None
) -> Iterator[Any]: ...
) -> Iterator[Incomplete]: ...
@property
def content(self) -> bytes: ...
@property
Expand All @@ -159,6 +159,6 @@ class Response:
**kwds: Any,
) -> Any: ...
@property
def links(self) -> dict[Any, Any]: ...
def links(self) -> dict[Incomplete, Incomplete]: ...
def raise_for_status(self) -> None: ...
def close(self) -> None: ...