-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stubs for
python-http-client
(#12626)
- Loading branch information
1 parent
089953e
commit 65170f4
Showing
6 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
python_http_client.version_file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
version = "3.3.7" | ||
upstream_repository = "https://github.com/sendgrid/python-http-client" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 28 additions & 0 deletions
28
stubs/python-http-client/python_http_client/exceptions.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: ... |