quart.datastructures module

class quart.datastructures.Accept(header_value: str)

Bases: object

property best
best_match(matches: List[str], default: Optional[str] = None) → Optional[str]
quality(key: str) → float
class quart.datastructures.AcceptOption(value, quality, parameters)

Bases: tuple

property parameters

Alias for field number 2

property quality

Alias for field number 1

property value

Alias for field number 0

class quart.datastructures.Authorization(cnonce: Optional[str] = None, nc: Optional[str] = None, nonce: Optional[str] = None, opaque: Optional[str] = None, password: Optional[str] = None, qop: Optional[str] = None, realm: Optional[str] = None, response: Optional[str] = None, uri: Optional[str] = None, username: Optional[str] = None)

Bases: object

class quart.datastructures.CIMultiDict

Bases: quart.datastructures._WerkzeugMultidictMixin, multidict._multidict.CIMultiDict

class quart.datastructures.CharsetAccept(header_value: str)

Bases: quart.datastructures.Accept

class quart.datastructures.ContentRange(units: Optional[str], start: Optional[int], stop: Optional[int], length: Union[int, str, None] = None, on_update: Optional[Callable] = None)

Bases: object

classmethod from_header(header: str, on_update: Optional[Callable] = None) → quart.datastructures.ContentRange
length
start
stop
to_header() → str
units
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.ETags(weak: Optional[Set[str]] = None, strong: Optional[Set[str]] = None, star: bool = False)

Bases: object

classmethod from_header(header: str) → quart.datastructures.ETags
to_header() → str
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.Headers

Bases: quart.datastructures.CIMultiDict

add(key: Any, value: Any, **kwargs: Any) → None

Add the key and value, not overwriting any previous value.

setdefault(key: Any, default: Optional[Any] = None) → Optional[str]

Return value for key, set value to default if key is not present.

class quart.datastructures.IfRange(etag: Optional[str] = None, date: Optional[datetime.datetime] = None)

Bases: object

classmethod from_header(header: str) → quart.datastructures.IfRange
to_header() → str
class quart.datastructures.LanguageAccept(header_value: str)

Bases: quart.datastructures.Accept

class quart.datastructures.MIMEAccept(header_value: str)

Bases: quart.datastructures.Accept

class quart.datastructures.MultiDict

Bases: quart.datastructures._WerkzeugMultidictMixin, multidict._multidict.MultiDict

class quart.datastructures.Range(units: str, ranges: List[quart.datastructures.RangeSet])

Bases: object

classmethod from_header(header: str) → quart.datastructures.Range
to_header() → str
class quart.datastructures.RangeSet(begin, end)

Bases: tuple

property begin

Alias for field number 0

property end

Alias for field number 1

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.RequestCacheControl(on_update: Optional[Callable] = None)

Bases: quart.datastructures._CacheControl

max_stale
min_fresh
no_transform
only_if_cached
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
class quart.datastructures.ResponseCacheControl(on_update: Optional[Callable] = None)

Bases: quart.datastructures._CacheControl

immutable
must_revalidate
private
proxy_revalidate
public
s_maxage