mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-04 12:35:49 +08:00
[python-http-client] Remove from pyrightconfig (#14321)
This commit is contained in:
@@ -83,7 +83,6 @@
|
||||
"stubs/PyMySQL",
|
||||
"stubs/python-datemath",
|
||||
"stubs/python-dateutil",
|
||||
"stubs/python-http-client",
|
||||
"stubs/python-jose",
|
||||
"stubs/pytz/pytz/lazy.pyi",
|
||||
"stubs/pywin32",
|
||||
|
||||
@@ -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]]
|
||||
|
||||
@@ -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): ...
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user