8000 fix: correct headers= kwarg in HTTP[S]Connection by dimaqq · Pull Request #12704 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

fix: correct headers= kwarg in HTTP[S]Connection #12704

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 5 commits into from
Oct 1, 2024
Merged
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
Prev Previous commit
use str instead of a Protocol
  • Loading branch information
dimaqq committed Oct 1, 2024
commit 5fc861a01f8719bac4095ad470bb95a163e26a0d
10 changes: 3 additions & 7 deletions stdlib/http/client.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import types
from _typeshed import ReadableBuffer, SupportsRead, SupportsReadline, WriteableBuffer
from collections.abc import Callable, Iterable, Iterator, Mapping
from socket import socket
from typing import Any, BinaryIO, Protocol, TypeVar, overload
from typing import Any, BinaryIO, TypeVar, overload
from typing_extensions import Self, TypeAlias

__all__ = [
Expand Down Expand Up @@ -34,11 +34,7 @@ __all__ = [
_DataType: TypeAlias = SupportsRead[bytes] | Iterable[ReadableBuffer] | ReadableBuffer
_T = TypeVar("_T")
_MessageT = TypeVar("_MessageT", bound=email.message.Message)

class _HasEncode(Protocol):
def encode(self, encoding: str) -> bytes: ...

_HeaderValue = ReadableBuffer | _HasEncode | int
_HeaderValue: TypeAlias = ReadableBuffer | str | int

HTTP_PORT: int
HTTPS_PORT: int
Expand Down Expand Up @@ -185,7 +181,7 @@ class HTTPConnection:
def connect(self) -> None: ...
def close(self) -> None: ...
def putrequest(self, method: str, url: str, skip_host: bool = False, skip_accept_encoding: bool = False) -> None: ...
def putheader(self, header: str | bytes, *argument: _HeaderValue) -> None: ...
def putheader(self, header: str | bytes, *values: _HeaderValue) -> None: ...
def endheaders(self, message_body: _DataType | None = None, *, encode_chunked: bool = False) -> None: ...
def send(self, data: _DataType | str) -> None: ...

Expand Down
0