class documentation

class FormDataParser:

View In Hierarchy

This class implements parsing of form data for Werkzeug. By itself it can parse multipart and url encoded form data. It can be subclassed and extended but for most mimetypes it is a better idea to use the untouched stream and expose it as separate attributes on a request object.

New in version 0.8.
Parameters
stream​_factoryAn optional callable that returns a new read and writeable file descriptor. This callable works the same as Response._get_file_stream.
charsetThe character set for URL and url encoded form data.
errorsThe encoding error behavior.
max​_form​_memory​_sizethe 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​_lengthIf this is provided and the transmitted data is longer than this value an ~exceptions.RequestEntityTooLarge exception is raised.
clsan optional dict class to use. If this is not specified or None the default MultiDict is used.
silentIf set to False parsing errors will not be caught.
Method __init__ Undocumented
Method get​_parse​_func Undocumented
Method parse Parses the information from the given stream, mimetype, content length and mimetype parameters.
Method parse​_from​_environ Parses the information from the environment as form data.
Class Variable parse​_functions Undocumented
Instance Variable charset Undocumented
Instance Variable cls Undocumented
Instance Variable errors Undocumented
Instance Variable max​_content​_length Undocumented
Instance Variable max​_form​_memory​_size Undocumented
Instance Variable silent Undocumented
Instance Variable stream​_factory Undocumented
Method ​_parse​_multipart Undocumented
Method ​_parse​_urlencoded Undocumented
def __init__(self, stream_factory=None, charset='utf-8', errors='replace', max_form_memory_size=None, max_content_length=None, cls=None, silent=True):

Undocumented

Parameters
stream​_factory:t.Optional[TStreamFactory]Undocumented
charset:strUndocumented
errors:strUndocumented
max​_form​_memory​_size:t.Optional[int]Undocumented
max​_content​_length:t.Optional[int]Undocumented
cls:t.Optional[t.Type[MultiDict]]Undocumented
silent:boolUndocumented
def get_parse_func(self, mimetype, options):

Undocumented

Parameters
mimetype:strUndocumented
options:t.Dict[str, str]Undocumented
Returns
t.Optional[t.Callable[[FormDataParser, t.IO[bytes], str, t.Optional[int], t.Dict[str, str]], t_parse_result]]Undocumented
def parse(self, stream, mimetype, content_length, options=None):
Parses the information from the given stream, mimetype, content length and mimetype parameters.
Parameters
stream:t.IO[bytes]an input stream
mimetype:strthe mimetype of the data
content​_length:t.Optional[int]the content length of the incoming data
options:t.Optional[t.Dict[str, str]]optional mimetype parameters (used for the multipart boundary for instance)
Returns
t_parse_resultA tuple in the form (stream, form, files).
def parse_from_environ(self, environ):
Parses the information from the environment as form data.
Parameters
environ:WSGIEnvironmentthe WSGI environment to be used for parsing.
Returns
t_parse_resultA tuple in the form (stream, form, files).
parse_functions: t.Dict[str, t.Callable[[FormDataParser, t.IO[bytes], str, t.Optional[int], t.Dict[str, str]], t_parse_result]] =

Undocumented

charset =

Undocumented

cls =

Undocumented

errors =

Undocumented

max_content_length =

Undocumented

max_form_memory_size =

Undocumented

silent =

Undocumented

stream_factory =

Undocumented

@exhaust_stream
def _parse_multipart(self, stream, mimetype, content_length, options):

Undocumented

Parameters
stream:t.IO[bytes]Undocumented
mimetype:strUndocumented
content​_length:t.Optional[int]Undocumented
options:t.Dict[str, str]Undocumented
Returns
t_parse_resultUndocumented
@exhaust_stream
def _parse_urlencoded(self, stream, mimetype, content_length, options):

Undocumented

Parameters
stream:t.IO[bytes]Undocumented
mimetype:strUndocumented
content​_length:t.Optional[int]Undocumented
options:t.Dict[str, str]Undocumented
Returns
t_parse_resultUndocumented