asgi#
- class starlite.handlers.asgi.ASGIRouteHandler#
Bases:
BaseRouteHandler
[ASGIRouteHandler
]ASGI Route Handler decorator.
Use this decorator to decorate ASGI applications.
- __init__(path: Union[str, None, List[str]] = None, *, exception_handlers: Optional[Dict[Union[int, Type[Exception]], Callable[[Any, _ExceptionT], Any]]] = None, guards: Optional[List[Callable[[Any, Any], Union[None, Awaitable[None]]]]] = None, name: Optional[str] = None, opt: Optional[Dict[str, Any]] = None, is_mount: bool = False, is_static: bool = False, **kwargs: Any) None #
Initialize
ASGIRouteHandler
.- Parameters:
exception_handlers – A dictionary that maps handler functions to status codes and/or exception types.
guards – A list of
Guard
callables.name – A string identifying the route handler.
opt – A string key dictionary of arbitrary values that can be accessed in
Guards
or wherever you have access toRequest
orASGI Scope
.path – A path fragment for the route handler function or a list of path fragments. If not given defaults to ‘/’
is_mount – A boolean dictating whether the handler’s paths should be regarded as mount paths. Mount path accept any arbitrary paths that begin with the defined prefixed path. For example, a mount with the path /some-path/ will accept requests for /some-path/ and any sub path under this, e.g. /some-path/sub-path/ etc.
is_static – A boolean dictating whether the handler’s paths should be regarded as static paths. Static paths are used to deliver static files.
**kwargs – Any additional kwarg - will be set in the opt dictionary.
- __call__(fn: Callable[[...], Awaitable[Any]]) ASGIRouteHandler #
Replace a function with itself.
- starlite.handlers.asgi.asgi#
alias of
ASGIRouteHandler