module documentation

Undocumented

Class ​Form​Data​Parser No summary
Class ​Multi​Part​Parser Undocumented
Class ​TStream​Factory Undocumented
Function default​_stream​_factory Undocumented
Function exhaust​_stream Helper decorator for methods that exhausts the stream on return.
Function parse​_form​_data Parse the form data in the environ and return it as tuple in the form (stream, form, files). You should only call this method if the transport method is POST, PUT, or PATCH.
Function parse​_multipart​_headers No summary
Constant F Undocumented
Variable ​Spooled​Temporary​File Undocumented
Variable t​_parse​_result Undocumented
Function ​_exhaust Undocumented
Function ​_line​_parse Removes line ending characters and returns a tuple (stripped_line, is_terminated).
def default_stream_factory(total_content_length, content_type, filename, content_length=None):

Undocumented

Parameters
total​_content​_length:t.Optional[int]Undocumented
content​_type:t.Optional[str]Undocumented
filename:t.Optional[str]Undocumented
content​_length:t.Optional[int]Undocumented
Returns
t.IO[bytes]Undocumented
def exhaust_stream(f):
Helper decorator for methods that exhausts the stream on return.
Parameters
f:FUndocumented
Returns
FUndocumented
def parse_form_data(environ, stream_factory=None, charset='utf-8', errors='replace', max_form_memory_size=None, max_content_length=None, cls=None, silent=True):

Parse the form data in the environ and return it as tuple in the form (stream, form, files). You should only call this method if the transport method is POST, PUT, or PATCH.

If the mimetype of the data transmitted is multipart/form-data the files multidict will be filled with FileStorage objects. If the mimetype is unknown the input stream is wrapped and returned as first argument, else the stream is empty.

This is a shortcut for the common usage of FormDataParser.

Have a look at :doc:`/request_data` for more details.

New in version 0.5: The max_form_memory_size, max_content_length and cls parameters were added.
New in version 0.5.1: The optional silent flag was added.
Parameters
environ:WSGIEnvironmentthe WSGI environment to be used for parsing.
stream​_factory:t.Optional[TStreamFactory]An optional callable that returns a new read and writeable file descriptor. This callable works the same as Response._get_file_stream.
charset:strThe character set for URL and url encoded form data.
errors:strThe encoding error behavior.
max​_form​_memory​_size:t.Optional[int]the maximum number of bytes to be accepted for in-memory stored form data. If the data exceeds the value specified an ~exceptions.RequestEntityTooLarge exception is raised.
max​_content​_length:t.Optional[int]If this is provided and the transmitted data is longer than this value an ~exceptions.RequestEntityTooLarge exception is raised.
cls:t.Optional[t.Type[MultiDict]]an optional dict class to use. If this is not specified or None the default MultiDict is used.
silent:boolIf set to False parsing errors will not be caught.
Returns
t_parse_resultA tuple in the form (stream, form, files).
def parse_multipart_headers(iterable):
Parses multipart headers from an iterable that yields lines (including the trailing newline symbol). The iterable has to be newline terminated. The iterable will stop at the line where the headers ended so it can be further consumed. :param iterable: iterable of strings that are newline terminated
Parameters
iterable:t.Iterable[bytes]Undocumented
Returns
HeadersUndocumented
F =

Undocumented

Value
t.TypeVar('F',
          bound=t.Callable[..., t.Any])
SpooledTemporaryFile =

Undocumented

t_parse_result =

Undocumented

def _exhaust(stream):

Undocumented

Parameters
stream:t.IO[bytes]Undocumented
def _line_parse(line):
Removes line ending characters and returns a tuple (stripped_line, is_terminated).
Parameters
line:strUndocumented
Returns
t.Tuple[str, bool]Undocumented