mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
Add stubs for python-http-client (#12626)
This commit is contained in:
committed by
GitHub
parent
089953ed84
commit
65170f4a2e
1
stubs/python-http-client/@tests/stubtest_allowlist.txt
Normal file
1
stubs/python-http-client/@tests/stubtest_allowlist.txt
Normal file
@@ -0,0 +1 @@
|
||||
python_http_client.version_file
|
||||
2
stubs/python-http-client/METADATA.toml
Normal file
2
stubs/python-http-client/METADATA.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
version = "3.3.7"
|
||||
upstream_repository = "https://github.com/sendgrid/python-http-client"
|
||||
20
stubs/python-http-client/python_http_client/__init__.pyi
Normal file
20
stubs/python-http-client/python_http_client/__init__.pyi
Normal file
@@ -0,0 +1,20 @@
|
||||
from typing import Final
|
||||
|
||||
from .client import Client as Client
|
||||
from .exceptions import (
|
||||
BadRequestsError as BadRequestsError,
|
||||
ForbiddenError as ForbiddenError,
|
||||
GatewayTimeoutError as GatewayTimeoutError,
|
||||
HTTPError as HTTPError,
|
||||
InternalServerError as InternalServerError,
|
||||
MethodNotAllowedError as MethodNotAllowedError,
|
||||
NotFoundError as NotFoundError,
|
||||
PayloadTooLargeError as PayloadTooLargeError,
|
||||
ServiceUnavailableError as ServiceUnavailableError,
|
||||
TooManyRequestsError as TooManyRequestsError,
|
||||
UnauthorizedError as UnauthorizedError,
|
||||
UnsupportedMediaTypeError as UnsupportedMediaTypeError,
|
||||
)
|
||||
|
||||
dir_path: Final[str]
|
||||
__version__: Final[str]
|
||||
31
stubs/python-http-client/python_http_client/client.pyi
Normal file
31
stubs/python-http-client/python_http_client/client.pyi
Normal file
@@ -0,0 +1,31 @@
|
||||
from email.message import Message
|
||||
from typing import Final
|
||||
|
||||
class Response:
|
||||
def __init__(self, response) -> None: ...
|
||||
@property
|
||||
def status_code(self) -> int: ...
|
||||
@property
|
||||
def body(self): ...
|
||||
@property
|
||||
def headers(self) -> Message: ...
|
||||
@property
|
||||
def to_dict(self): ...
|
||||
|
||||
class Client:
|
||||
methods: Final[set[str]]
|
||||
host: str
|
||||
request_headers: dict[str, str]
|
||||
append_slash: bool
|
||||
timeout: int
|
||||
def __init__(
|
||||
self,
|
||||
host: str,
|
||||
request_headers: dict[str, str] | None = None,
|
||||
version: int | None = None,
|
||||
url_path: list[str] | None = None,
|
||||
append_slash: bool = False,
|
||||
timeout: int | None = None,
|
||||
) -> None: ...
|
||||
def _(self, name: str) -> Client: ...
|
||||
def __getattr__(self, name: str) -> Client | Response: ...
|
||||
28
stubs/python-http-client/python_http_client/exceptions.pyi
Normal file
28
stubs/python-http-client/python_http_client/exceptions.pyi
Normal file
@@ -0,0 +1,28 @@
|
||||
from email.message import Message
|
||||
from typing import Final
|
||||
|
||||
class HTTPError(Exception):
|
||||
status_code: int
|
||||
reason: str
|
||||
body: str
|
||||
headers: Message
|
||||
def __init__(self, *args) -> None: ...
|
||||
def __reduce__(self): ...
|
||||
@property
|
||||
def to_dict(self): ...
|
||||
|
||||
class BadRequestsError(HTTPError): ...
|
||||
class UnauthorizedError(HTTPError): ...
|
||||
class ForbiddenError(HTTPError): ...
|
||||
class NotFoundError(HTTPError): ...
|
||||
class MethodNotAllowedError(HTTPError): ...
|
||||
class PayloadTooLargeError(HTTPError): ...
|
||||
class UnsupportedMediaTypeError(HTTPError): ...
|
||||
class TooManyRequestsError(HTTPError): ...
|
||||
class InternalServerError(HTTPError): ...
|
||||
class ServiceUnavailableError(HTTPError): ...
|
||||
class GatewayTimeoutError(HTTPError): ...
|
||||
|
||||
err_dict: Final[dict[int, type[HTTPError]]]
|
||||
|
||||
def handle_error(error) -> HTTPError: ...
|
||||
Reference in New Issue
Block a user