faust.web.views

Class-based views.

class faust.web.views.View(app: faust.types.app.AppT, web: faust.web.base.Web) → None[source]

View (HTTP endpoint).

exception ServerError(detail: str = None, *, code: int = None, **extra_context) → None
code = 500
detail = 'Internal server error.'
exception ValidationError(detail: str = None, *, code: int = None, **extra_context) → None
code = 400
detail = 'Invalid input.'
exception ParseError(detail: str = None, *, code: int = None, **extra_context) → None
code = 400
detail = 'Malformed request.'
exception NotAuthenticated(detail: str = None, *, code: int = None, **extra_context) → None
code = 401
detail = 'Authentication credentials were not provided.'
exception PermissionDenied(detail: str = None, *, code: int = None, **extra_context) → None
code = 403
detail = 'You do not have permission to perform this action.'
exception NotFound(detail: str = None, *, code: int = None, **extra_context) → None
code = 404
detauil = 'Not found.'
classmethod from_handler(fun: Union[Callable[[faust.types.web.View, faust.types.web.Request], Union[Coroutine[[Any, Any], faust.types.web.Response], Awaitable[faust.types.web.Response]]], Callable[[faust.types.web.View, faust.types.web.Request, Any, Any], Union[Coroutine[[Any, Any], faust.types.web.Response], Awaitable[faust.types.web.Response]]]]) → Type[faust.web.views.View][source]
Return type:Type[View]
text(value: str, *, content_type: str = None, status: int = 200) → faust.web.base.Response[source]
Return type:Response
html(value: str, *, status: int = 200) → faust.web.base.Response[source]
Return type:Response
json(value: Any, *, status: int = 200) → faust.web.base.Response[source]
Return type:Response
bytes(value: bytes, *, content_type: str = None, status: int = 200) → faust.web.base.Response[source]
Return type:Response
bytes_to_response(s: bytes) → faust.web.base.Response[source]
Return type:Response
response_to_bytes(response: faust.web.base.Response) → bytes[source]
Return type:bytes
route(pattern: str, handler: Callable) → Any[source]
Return type:Any
notfound(reason: str = 'Not Found', **kwargs) → faust.web.base.Response[source]
Return type:Response
error(status: int, reason: str, **kwargs) → faust.web.base.Response[source]
Return type:Response
coroutine delete(self, request: faust.web.base.Request, **kwargs) → Any[source]
coroutine dispatch(self, request: Any) → Any[source]
Return type:Any
coroutine get(self, request: faust.web.base.Request, **kwargs) → Any[source]
coroutine head(self, request: faust.web.base.Request, **kwargs) → Any[source]
coroutine on_request_error(self, request: faust.web.base.Request, exc: faust.web.exceptions.WebError) → faust.web.base.Response[source]
Return type:Response
coroutine patch(self, request: faust.web.base.Request, **kwargs) → Any[source]
coroutine post(self, request: faust.web.base.Request, **kwargs) → Any[source]
coroutine put(self, request: faust.web.base.Request, **kwargs) → Any[source]
coroutine read_request_content(self, request: faust.web.base.Request) → bytes[source]
Return type:bytes
faust.web.views.takes_model(Model: Type[faust.types.models.ModelT]) → Callable[Union[Callable[[faust.types.web.View, faust.types.web.Request], Union[Coroutine[[Any, Any], faust.types.web.Response], Awaitable[faust.types.web.Response]]], Callable[[faust.types.web.View, faust.types.web.Request, Any, Any], Union[Coroutine[[Any, Any], faust.types.web.Response], Awaitable[faust.types.web.Response]]]], Union[Callable[[faust.types.web.View, faust.types.web.Request], Union[Coroutine[[Any, Any], faust.types.web.Response], Awaitable[faust.types.web.Response]]], Callable[[faust.types.web.View, faust.types.web.Request, Any, Any], Union[Coroutine[[Any, Any], faust.types.web.Response], Awaitable[faust.types.web.Response]]]]][source]
Return type:Callable[[Union[Callable[[View, Request], Union[Coroutine[Any, Any, Response], Awaitable[Response]]], Callable[[View, Request, Any, Any], Union[Coroutine[Any, Any, Response], Awaitable[Response]]]]], Union[Callable[[View, Request], Union[Coroutine[Any, Any, Response], Awaitable[Response]]], Callable[[View, Request, Any, Any], Union[Coroutine[Any, Any, Response], Awaitable[Response]]]]]
faust.web.views.gives_model(Model: Type[faust.types.models.ModelT]) → Callable[Union[Callable[[faust.types.web.View, faust.types.web.Request], Union[Coroutine[[Any, Any], faust.types.web.Response], Awaitable[faust.types.web.Response]]], Callable[[faust.types.web.View, faust.types.web.Request, Any, Any], Union[Coroutine[[Any, Any], faust.types.web.Response], Awaitable[faust.types.web.Response]]]], Union[Callable[[faust.types.web.View, faust.types.web.Request], Union[Coroutine[[Any, Any], faust.types.web.Response], Awaitable[faust.types.web.Response]]], Callable[[faust.types.web.View, faust.types.web.Request, Any, Any], Union[Coroutine[[Any, Any], faust.types.web.Response], Awaitable[faust.types.web.Response]]]]][source]
Return type:Callable[[Union[Callable[[View, Request], Union[Coroutine[Any, Any, Response], Awaitable[Response]]], Callable[[View, Request, Any, Any], Union[Coroutine[Any, Any, Response], Awaitable[Response]]]]], Union[Callable[[View, Request], Union[Coroutine[Any, Any, Response], Awaitable[Response]]], Callable[[View, Request, Any, Any], Union[Coroutine[Any, Any, Response], Awaitable[Response]]]]]