2 from _typeshed.wsgi import StartResponse, WSGIEnvironment
3 from typing import Any, Iterable, NoReturn, Protocol, Text, Tuple, Type
5 from werkzeug.wrappers import Response
7 class _EnvironContainer(Protocol):
9 def environ(self) -> WSGIEnvironment: ...
11 class HTTPException(Exception):
13 description: Text | None
14 response: Response | None
15 def __init__(self, description: Text | None = ..., response: Response | None = ...) -> None: ...
17 def wrap(cls, exception: Type[Exception], name: str | None = ...) -> Any: ...
19 def name(self) -> str: ...
20 def get_description(self, environ: WSGIEnvironment | None = ...) -> Text: ...
21 def get_body(self, environ: WSGIEnvironment | None = ...) -> Text: ...
22 def get_headers(self, environ: WSGIEnvironment | None = ...) -> list[tuple[str, str]]: ...
23 def get_response(self, environ: WSGIEnvironment | _EnvironContainer | None = ...) -> Response: ...
24 def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
26 default_exceptions: dict[int, Type[HTTPException]]
28 class BadRequest(HTTPException):
32 class ClientDisconnected(BadRequest): ...
33 class SecurityError(BadRequest): ...
34 class BadHost(BadRequest): ...
36 class Unauthorized(HTTPException):
39 www_authenticate: Iterable[object] | None
42 description: Text | None = ...,
43 response: Response | None = ...,
44 www_authenticate: None | Tuple[object, ...] | list[object] | object = ...,
47 class Forbidden(HTTPException):
51 class NotFound(HTTPException):
55 class MethodNotAllowed(HTTPException):
59 def __init__(self, valid_methods: Any | None = ..., description: Any | None = ...): ...
61 class NotAcceptable(HTTPException):
65 class RequestTimeout(HTTPException):
69 class Conflict(HTTPException):
73 class Gone(HTTPException):
77 class LengthRequired(HTTPException):
81 class PreconditionFailed(HTTPException):
85 class RequestEntityTooLarge(HTTPException):
89 class RequestURITooLarge(HTTPException):
93 class UnsupportedMediaType(HTTPException):
97 class RequestedRangeNotSatisfiable(HTTPException):
102 def __init__(self, length: Any | None = ..., units: str = ..., description: Any | None = ...): ...
104 class ExpectationFailed(HTTPException):
108 class ImATeapot(HTTPException):
112 class UnprocessableEntity(HTTPException):
116 class Locked(HTTPException):
120 class FailedDependency(HTTPException):
124 class PreconditionRequired(HTTPException):
128 class _RetryAfter(HTTPException):
129 retry_after: None | int | datetime.datetime
131 self, description: Text | None = ..., response: Response | None = ..., retry_after: None | int | datetime.datetime = ...
134 class TooManyRequests(_RetryAfter):
138 class RequestHeaderFieldsTooLarge(HTTPException):
142 class UnavailableForLegalReasons(HTTPException):
146 class InternalServerError(HTTPException):
148 self, description: Text | None = ..., response: Response | None = ..., original_exception: Exception | None = ...
153 class NotImplemented(HTTPException):
157 class BadGateway(HTTPException):
161 class ServiceUnavailable(_RetryAfter):
165 class GatewayTimeout(HTTPException):
169 class HTTPVersionNotSupported(HTTPException):
175 def __init__(self, mapping: Any | None = ..., extra: Any | None = ...) -> None: ...
176 def __call__(self, code: int | Response, *args: Any, **kwargs: Any) -> NoReturn: ...
178 def abort(status: int | Response, *args: Any, **kwargs: Any) -> NoReturn: ...
180 class BadRequestKeyError(BadRequest, KeyError): ...