quart.wrappers.request module

class quart.wrappers.request.Body(expected_content_length: Optional[int], max_content_length: Optional[int])

Bases: object

A request body container.

The request body can either be iterated over and consumed in parts (without building up memory usage) or awaited.

async for data in body:
# or simply
complete = await body

Note: It is not possible to iterate over the data and then await it.

append(data: bytes) → None
set_complete() → None
set_result(data: bytes) → None

Convienience method, mainly for testing.

class quart.wrappers.request.Request(method: str, scheme: str, path: str, query_string: bytes, headers: werkzeug.datastructures.Headers, root_path: str, http_version: str, *, max_content_length: Optional[int] = None, body_timeout: Optional[int] = None, send_push_promise: Callable[[str, werkzeug.datastructures.Headers], Awaitable[None]], scope: Optional[dict] = None)

Bases: quart.wrappers.base.BaseRequestWebsocket, quart.wrappers.base.JSONMixin

This class represents a request.

It can be subclassed and the subclassed used in preference by replacing the request_class with your subclass.


The class to store the body data within.


alias of Body

property content_encoding
property content_length
property content_md5
property content_type
property data
property files

The parsed files.

This will return an empty multidict unless the request mimetype was enctype="multipart/form-data" and the method POST, PUT, or PATCH.

property form

The parsed form encoded data.

Note file data is present in the files.

async get_data(raw: bool = True) → AnyStr

The request body data.

async send_push_promise(path: str) → None
property values
class quart.wrappers.request.Websocket(path: str, query_string: bytes, scheme: str, headers: werkzeug.datastructures.Headers, root_path: str, http_version: str, subprotocols: List[str], receive: Callable, send: Callable, accept: Callable)

Bases: quart.wrappers.base.BaseRequestWebsocket

async accept(headers: Optional[Union[dict, werkzeug.datastructures.Headers]] = None, subprotocol: Optional[str] = None) → None

Manually chose to accept the websocket connection.

  • headers – Additional headers to send with the acceptance response.

  • subprotocol – The chosen subprotocol, optional.

async receive() → AnyStr
async receive_json() → Any
property requested_subprotocols
async send(data: AnyStr) → None
async send_json(data: Any) → None