Skip to main content

Request

The request object used by default in Flask. Remembers the matched endpoint and view arguments.

Attributes

AttributeTypeDescription
json_modulet.Any = jsonThe module used for JSON serialization and deserialization, defaulting to the standard library json module.
url_rule`RuleNone` = None
view_args`dict[str, t.Any]None` = None
routing_exception`HTTPExceptionNone` = None

Constructor

Signature

def Request()

Methods


max_content_length()

@classmethod
def max_content_length() - > int | None

The maximum number of bytes that will be read during this request. If this limit is exceeded, a 413 :exc:~werkzeug.exceptions.RequestEntityTooLarge error is raised.

Returns

TypeDescription
`intNone`

max_content_length()

@classmethod
def max_content_length(
value: int | None
) - > None

Sets the maximum number of bytes that will be read during this specific request.

Parameters

NameTypeDescription
value`intNone`

Returns

TypeDescription
Nonenull

max_form_memory_size()

@classmethod
def max_form_memory_size() - > int | None

The maximum size in bytes any non-file form field may be in a multipart/form-data body. If this limit is exceeded, a 413 :exc:~werkzeug.exceptions.RequestEntityTooLarge error is raised.

Returns

TypeDescription
`intNone`

max_form_memory_size()

@classmethod
def max_form_memory_size(
value: int | None
) - > None

Sets the maximum size in bytes any non-file form field may be for this specific request.

Parameters

NameTypeDescription
value`intNone`

Returns

TypeDescription
Nonenull

max_form_parts()

@classmethod
def max_form_parts() - > int | None

The maximum number of fields that may be present in a multipart/form-data body. If this limit is exceeded, a 413 :exc:~werkzeug.exceptions.RequestEntityTooLarge error is raised.

Returns

TypeDescription
`intNone`

max_form_parts()

@classmethod
def max_form_parts(
value: int | None
) - > None

Sets the maximum number of fields allowed in a multipart form body for this specific request.

Parameters

NameTypeDescription
value`intNone`

Returns

TypeDescription
Nonenull

endpoint()

@classmethod
def endpoint() - > str | None

The endpoint that matched the request URL. This will be None if matching failed or has not been performed yet.

Returns

TypeDescription
`strNone`

blueprint()

@classmethod
def blueprint() - > str | None

The registered name of the current blueprint. This will be None if the endpoint is not part of a blueprint, or if URL matching failed.

Returns

TypeDescription
`strNone`

blueprints()

@classmethod
def blueprints() - > list[str]

The registered names of the current blueprint upwards through parent blueprints.

Returns

TypeDescription
list[str]A list of blueprint names starting from the current one up to the root.

on_json_loading_failed()

@classmethod
def on_json_loading_failed(
e: ValueError | None
) - > t.Any

Handles failures during JSON parsing, raising a BadRequest exception or re-raising the original error if the application is in debug mode.

Parameters

NameTypeDescription
e`ValueErrorNone`

Returns

TypeDescription
t.AnyThe result of the parent class's failure handler, or raises an exception.