Skip to content

[python-http-client] Remove from pyrightconfig #14321

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 0 additions & 1 deletion pyrightconfig.stricter.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
"stubs/python-crontab",
"stubs/python-datemath",
"stubs/python-dateutil",
"stubs/python-http-client",
"stubs/python-jose",
"stubs/pytz/pytz/lazy.pyi",
"stubs/pywin32",
Expand Down
9 changes: 5 additions & 4 deletions stubs/python-http-client/python_http_client/client.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
from email.message import Message
from typing import Final
from http.client import HTTPResponse
from typing import Any, Final

class Response:
def __init__(self, response) -> None: ...
def __init__(self, response: HTTPResponse) -> None: ...
@property
def status_code(self) -> int: ...
@property
def body(self): ...
def body(self) -> bytes: ...
@property
def headers(self) -> Message: ...
@property
def to_dict(self): ...
def to_dict(self) -> dict[str, Any] | None: ... # dict of response from API if body is not empty

class Client:
methods: Final[set[str]]
Expand Down
16 changes: 10 additions & 6 deletions stubs/python-http-client/python_http_client/exceptions.pyi
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
from email.message import Message
from typing import Final
from typing import Any, Final, overload
from urllib.error import HTTPError as _HTTPError

class HTTPError(Exception):
status_code: int
reason: str
body: str
body: bytes
headers: Message
def __init__(self, *args) -> None: ...
def __reduce__(self): ...
@overload
def __init__(self, status_code: int, reason: str, body: bytes, headers: Message, /) -> None: ...
@overload
def __init__(self, http_error: _HTTPError, /) -> None: ...
def __reduce__(self) -> tuple[type[HTTPError], tuple[int, str, bytes, Message]]: ...
@property
def to_dict(self): ...
def to_dict(self) -> dict[str, Any]: ... # dict of response error from the API

class BadRequestsError(HTTPError): ...
class UnauthorizedError(HTTPError): ...
Expand All @@ -25,4 +29,4 @@ class GatewayTimeoutError(HTTPError): ...

err_dict: Final[dict[int, type[HTTPError]]]

def handle_error(error) -> HTTPError: ...
def handle_error(error: _HTTPError) -> HTTPError: ...