Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions python/wreq/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions python/wreq/proxy.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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]
Expand Down
21 changes: 11 additions & 10 deletions python/wreq/wreq.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
from typing import (
Any,
AsyncGenerator,
Dict,
Mapping,
Generator,
NotRequired,
Sequence,
Mapping,
Tuple,
TypedDict,
Unpack,
Expand Down Expand Up @@ -527,7 +528,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.
"""
Expand Down Expand Up @@ -795,7 +796,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.
"""
Expand All @@ -810,7 +811,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.
"""
Expand Down Expand Up @@ -916,15 +917,15 @@ 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.
"""

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.
Expand All @@ -940,7 +941,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]
Expand Down Expand Up @@ -981,7 +982,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.
"""
Expand All @@ -996,7 +997,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.
"""
Expand Down Expand Up @@ -1028,7 +1029,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.
Expand Down