Aeros.Request

This module contains the wrapper for Quart.request that can be used inside web methods

Module Contents

Classes

EasyRequest

A helper class that makes request handling more uniform.

class Aeros.Request.EasyRequest[source]

A helper class that makes request handling more uniform.

All attributes are assessable via the same syntax, while with Flask.request or quart.request, you will have slightly different syntax when retrieving different request attributes, which can be very irritating and take much time debugging your code for missing parentheses or an await statement.

Hint

You only need to await attributes that need calculation, for example evaluating the request body, like .json or .form.

headers = EasyRequest.headers
params = EasyRequest.params
form = await EasyRequest.form # requires time for calculation
json = await EasyRequest.json # requires time for calculation
params :dict

The URL parameters like Flask.request.params.

headers :dict

The request headers like quart.request.headers.

cookies :dict

The request cookies like quart.request.cookies.

__quart_request :request

The quart.request. instance that is used in the current scope.

__load(self)

Loads the content of quart.request into this instance and returns it.

__call__(self, f)[source]

Decorates an endpoint function to use the EasyRequest with, which makes EasyRequest available in that endpoint method.

async property form(self)

The request form data like quart.request.form.

async property json(self)

The request body data (as JSON) like quart.request.form.

Be aware that in order for quart.request.get_json() to return a JSON dictionary, the Content-Type header must be set to application/json.

Aeros.Request.app