Skip to content
Myr

Fix mutability issues with headers input types (#7431)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Nate Prewitt · committed by GitHub · parent 5691f59 · Browse files · 3 files+6 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+6 added−6 removed

  • other:+6 added−6 removed

3 files+6 added−6 removed

modified:src/requests/_types.py+2 added-3 removed
107 unmodified lines
108 BodyType: TypeAlias = (109 bytes | str | Iterable[bytes | str] | SupportsRead[bytes | str] | None110 )111112 HeadersType: TypeAlias = CaseInsensitiveDict[str] | Mapping[str, str | bytes]113 HeadersUpdateType: TypeAlias = Mapping[str, str | bytes | None]112 HeadersType: TypeAlias = MutableMapping[str, str | bytes] | None113114 CookiesType: TypeAlias = RequestsCookieJar | Mapping[str, str]115116 # Building blocks for FilesType
32 unmodified lines
149150 # TypedDicts for Unpack kwargs (PEP 692)151152 class BaseRequestKwargs(TypedDict, total=False):154 headers: Mapping[str, str | bytes] | None153 headers: HeadersType154 cookies: RequestsCookieJar | CookieJar | dict[str, str] | None155 files: FilesType156 auth: AuthType157 timeout: TimeoutType
26 unmodified lines
modified:src/requests/models.py+3 added-2 removed
81 unmodified lines
82 to_key_val_list,83)8485if TYPE_CHECKING:86 from collections.abc import MutableMapping87 from http.cookiejar import CookieJar8889 from typing_extensions import Self90
219 unmodified lines
310 """311312 method: str | None313 url: _t.UriType | None313 headers: CaseInsensitiveDict[str] | Mapping[str, str | bytes] | None314 headers: MutableMapping[str, str | bytes]315 files: _t.FilesType316 data: _t.DataType317 json: _t.JsonType318 params: _t.ParamsType
3 unmodified lines
322 def __init__(323 self,324 method: str | None = None,325 url: _t.UriType | None = None,325 headers: Mapping[str, str | bytes] | None = None,326 headers: _t.HeadersType = None,327 files: _t.FilesType = None,328 data: _t.DataType = None,329 params: _t.ParamsType = None,330 auth: _t.AuthType = None,
851 unmodified lines
modified:src/requests/sessions.py+1 added-1 removed
558 unmodified lines
559 method: str,560 url: _t.UriType,561 params: _t.ParamsType = None,562 data: _t.DataType = None,563 headers: Mapping[str, str | bytes] | None = None,563 headers: _t.HeadersType = None,564 cookies: RequestsCookieJar | CookieJar | dict[str, str] | None = None,565 files: _t.FilesType = None,566 auth: _t.AuthType = None,567 timeout: _t.TimeoutType = None,
353 unmodified lines