quart.datastructures module

class quart.datastructures.ContentSecurityPolicy(on_update: Optional[Callable] = None)

Bases: object

base_uri
child_src
connect_src
default_src
font_src
form_action
frame_ancestors
frame_src
classmethod from_header(header: str, on_update: Optional[Callable] = None) → quart.datastructures.ContentSecurityPolicy
img_src
manifest_src
media_src
navigate_to
object_src
plugin_types
prefetch_src
report_uri
sandbox
script_src
script_src_attr
script_src_elem
style_src
style_src_attr
style_src_elem
to_header() → str
worker_src
class quart.datastructures.FileStorage(stream: BinaryIO = None, filename: str = None, name: str = None, content_type: str = None, headers: Dict = None)

Bases: object

A thin wrapper over incoming files.

close() → None
property content_length

The content-length sent in the header.

property content_type

The content-type sent in the header.

property mimetype

Returns the mimetype parsed from the Content-Type header.

property mimetype_params

Returns the params parsed from the Content-Type header.

save(destination: BinaryIO, buffer_size: int = 16384) → None

Save the file to the destination.

Parameters
  • destination – A filename (str) or file object to write to.

  • buffer_size – Buffer size as used as length in shutil.copyfileobj().

class quart.datastructures.HeaderSet(*args: Any, on_update: Optional[Callable] = None, **kwargs: Any)

Bases: set

add()

Add an element to a set.

This has no effect if the element is already present.

clear()

Remove all elements from this set.

classmethod from_header(header: str, on_update: Optional[Callable] = None) → quart.datastructures.HeaderSet
pop()

Remove and return an arbitrary set element. Raises KeyError if the set is empty.

remove()

Remove an element from a set; it must be a member.

If the element is not a member, raise a KeyError.

to_header() → str
update()

Update a set with the union of itself and others.

class quart.datastructures.RequestAccessControl(origin: str, request_headers: quart.datastructures.HeaderSet, request_method: str)

Bases: object

classmethod from_headers(origin_header: str, request_headers_header: str, request_method_header: str) → quart.datastructures.RequestAccessControl
class quart.datastructures.ResponseAccessControl(allow_credentials: Optional[bool], allow_headers: quart.datastructures.HeaderSet, allow_methods: quart.datastructures.HeaderSet, allow_origin: quart.datastructures.HeaderSet, expose_headers: quart.datastructures.HeaderSet, max_age: Optional[float], on_update: Optional[Callable] = None)

Bases: object

property allow_credentials
allow_headers
allow_methods
allow_origin
expose_headers
classmethod from_headers(allow_credentials_header: str, allow_headers_header: str, allow_methods_header: str, allow_origin_header: str, expose_headers_header: str, max_age_header: str, on_update: Optional[Callable] = None) → quart.datastructures.ResponseAccessControl
property max_age
on_update(_: Any = None) → None