diff --git a/python/wreq/header.py b/python/wreq/header.py index 50d44d13..22291ae1 100644 --- a/python/wreq/header.py +++ b/python/wreq/header.py @@ -11,7 +11,7 @@ Set-Cookie, Accept-Encoding, etc.). """ -from typing import Dict, Iterator, Sequence, Tuple +from typing import Mapping, Iterator, Sequence, Tuple __all__ = ["HeaderMap", "OrigHeaderMap"] @@ -58,7 +58,7 @@ def __str__(self) -> str: ... def __init__( - self, init: Dict[str, str] | None = None, capacity: int | None = None + self, init: Mapping[str, str] | None = None, capacity: int | None = None ) -> None: """ Create a new HeaderMap. diff --git a/python/wreq/proxy.py b/python/wreq/proxy.py index 768a1674..2f7e03d7 100644 --- a/python/wreq/proxy.py +++ b/python/wreq/proxy.py @@ -1,4 +1,4 @@ -from typing import Dict, NotRequired, TypedDict, Unpack, final +from typing import Mapping, NotRequired, TypedDict, Unpack, final from wreq.header import HeaderMap @@ -15,7 +15,7 @@ class ProxyConfig(TypedDict): custom_http_auth: NotRequired[str] r"""Custom HTTP proxy authentication header value.""" - custom_http_headers: NotRequired[Dict[str, str] | HeaderMap] + custom_http_headers: NotRequired[Mapping[str, str] | HeaderMap] r"""Custom HTTP proxy headers.""" exclusion: NotRequired[str] diff --git a/python/wreq/wreq.py b/python/wreq/wreq.py index 2be42022..52584323 100644 --- a/python/wreq/wreq.py +++ b/python/wreq/wreq.py @@ -5,10 +5,10 @@ from typing import ( Any, AsyncGenerator, - Dict, Generator, NotRequired, Sequence, + Mapping, Tuple, TypedDict, Unpack, @@ -527,7 +527,7 @@ class ClientConfig(TypedDict): Sets the `User-Agent` header to be used by this client. """ - headers: NotRequired[Dict[str, str] | HeaderMap] + headers: NotRequired[Mapping[str, str] | HeaderMap] """ Sets the default headers for every request. """ @@ -795,7 +795,7 @@ class Request(TypedDict): The Emulation settings for the request. """ - headers: NotRequired[Dict[str, str] | HeaderMap] + headers: NotRequired[Mapping[str, str] | HeaderMap] """ The headers to use for the request. """ @@ -810,7 +810,7 @@ class Request(TypedDict): The option enables default headers. """ - cookies: NotRequired[str | Dict[str, str]] + cookies: NotRequired[str | Mapping[str, str]] """ The cookies to use for the request. """ @@ -916,7 +916,7 @@ class Request(TypedDict): query: NotRequired[ Sequence[Tuple[str, str | int | float | bool]] - | Dict[str, str | int | float | bool] + | Mapping[str, str | int | float | bool] ] """ The query parameters to use for the request. @@ -924,7 +924,7 @@ class Request(TypedDict): form: NotRequired[ Sequence[Tuple[str, str | int | float | bool]] - | Dict[str, str | int | float | bool] + | Mapping[str, str | int | float | bool] ] """ The form parameters to use for the request. @@ -940,7 +940,7 @@ class Request(TypedDict): | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] - | Dict[str, str | int | float | bool] + | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str] @@ -981,7 +981,7 @@ class WebSocketRequest(TypedDict): Bind to an interface by SO_BINDTODEVICE. """ - headers: NotRequired[Dict[str, str] | HeaderMap] + headers: NotRequired[Mapping[str, str] | HeaderMap] """ The headers to use for the request. """ @@ -996,7 +996,7 @@ class WebSocketRequest(TypedDict): The option enables default headers. """ - cookies: NotRequired[str | Dict[str, str]] + cookies: NotRequired[str | Mapping[str, str]] """ The cookies to use for the request. """ @@ -1028,7 +1028,7 @@ class WebSocketRequest(TypedDict): query: NotRequired[ Sequence[Tuple[str, str | int | float | bool]] - | Dict[str, str | int | float | bool] + | Mapping[str, str | int | float | bool] ] """ The query parameters to use for the request.