faust.web.base

Base interface for Web server and views.

class faust.web.base.Response[source]

Web server response and status.

status
Return type:int
body
Return type:bytes
headers
Return type:MutableMapping[~KT, ~VT]
content_length
Return type:Optional[int]
content_type
Return type:str
charset
Return type:Optional[str]
chunked
Return type:bool
compression
Return type:bool
keep_alive
Return type:Optional[bool]
body_length
Return type:int
class faust.web.base.BlueprintManager(initial: Iterable[Tuple[str, Union[_T, str]]] = None) → None[source]

Manager of all blueprints.

add(prefix: str, blueprint: Union[_T, str]) → None[source]
Return type:None
apply(web: faust.web.base.Web) → None[source]
Return type:None
class faust.web.base.Web(app: faust.types.app.AppT, **kwargs) → None[source]

Web server and HTTP interface.

default_blueprints = [('/graph', 'faust.web.apps.graph:blueprint'), ('', 'faust.web.apps.stats:blueprint'), ('/router', 'faust.web.apps.router:blueprint'), ('/table', 'faust.web.apps.tables.blueprint')]
content_separator = b'\r\n\r\n'
header_separator = b'\r\n'
header_key_value_separator = b': '
text(value: str, *, content_type: str = None, status: int = 200, reason: str = None, headers: MutableMapping = None) → faust.web.base.Response[source]
Return type:Response
html(value: str, *, content_type: str = None, status: int = 200, reason: str = None, headers: MutableMapping = None) → faust.web.base.Response[source]
Return type:Response
json(value: Any, *, content_type: str = None, status: int = 200, reason: str = None, headers: MutableMapping = None) → faust.web.base.Response[source]
Return type:Response
bytes(value: bytes, *, content_type: str = None, status: int = 200, reason: str = None, headers: MutableMapping = None) → 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, cors_options: Mapping[str, faust.types.web.ResourceOptions] = None) → None[source]
Return type:None
add_static(prefix: str, path: Union[pathlib.Path, str], **kwargs) → None[source]
Return type:None
add_view(view_cls: Type[faust.types.web.View], *, prefix: str = '', cors_options: Mapping[str, faust.types.web.ResourceOptions] = None) → faust.types.web.View[source]
Return type:View
url_for(view_name: str, **kwargs) → str[source]

Get URL by view name.

If the provided view name has associated URL parameters, those need to be passed in as kwargs, or a TypeError will be raised.

Return type:str
init_server() → None[source]
Return type:None
url
Return type:URL
logger = <Logger faust.web.base (WARNING)>
coroutine read_request_content(self, request: faust.web.base.Request) → bytes[source]
Return type:bytes
coroutine wsgi(self) → Any[source]
Return type:Any
class faust.web.base.Request(*args, **kwargs)[source]

HTTP Request.

coroutine json(self) → Any[source]
Return type:Any
coroutine post(self) → Mapping[str, str][source]
Return type:Mapping[str, str]
coroutine read(self) → bytes[source]
Return type:bytes
coroutine text(self) → str[source]
Return type:str
can_read_body() → bool[source]
Return type:bool
match_info
Return type:Mapping[str, str]
query
Return type:Mapping[str, str]
cookies
Return type:Mapping[str, Any]