class documentation

class FormDataParser: (source)

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. .. versionadded:: 0.8 :param stream_factory: An optional callable that returns a new read and writeable file descriptor. This callable works the same as :meth:`Response._get_file_stream`. :param charset: The character set for URL and url encoded form data. :param errors: The encoding error behavior. :param max_form_memory_size: the maximum number of bytes to be accepted for in-memory stored form data. If the data exceeds the value specified an :exc:`~exceptions.RequestEntityTooLarge` exception is raised. :param max_content_length: If this is provided and the transmitted data is longer than this value an :exc:`~exceptions.RequestEntityTooLarge` exception is raised. :param cls: an optional dict class to use. If this is not specified or `None` the default :class:`MultiDict` is used. :param silent: If set to False parsing errors will not be caught. :param max_form_parts: The maximum number of parts to be parsed. If this is exceeded, a :exc:`~exceptions.RequestEntityTooLarge` exception is raised.

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 max_form_parts Undocumented
Instance Variable silent Undocumented
Instance Variable stream_factory Undocumented
Method _parse_multipart Undocumented
Method _parse_urlencoded Undocumented
def __init__(self, stream_factory: t.Optional[TStreamFactory] = None, charset: str = 'utf-8', errors: str = 'replace', max_form_memory_size: t.Optional[int] = None, max_content_length: t.Optional[int] = None, cls: t.Optional[t.Type[MultiDict]] = None, silent: bool = True, *, max_form_parts: t.Optional[int] = None): (source)

Undocumented

def get_parse_func(self, mimetype: str, options: t.Dict[str, str]) -> t.Optional[t.Callable[[FormDataParser, t.IO[bytes], str, t.Optional[int], t.Dict[str, str]], t_parse_result]]: (source)

Undocumented

def parse(self, stream: t.IO[bytes], mimetype: str, content_length: t.Optional[int], options: t.Optional[t.Dict[str, str]] = None) -> t_parse_result: (source)

Parses the information from the given stream, mimetype, content length and mimetype parameters. :param stream: an input stream :param mimetype: the mimetype of the data :param content_length: the content length of the incoming data :param options: optional mimetype parameters (used for the multipart boundary for instance) :return: A tuple in the form ``(stream, form, files)``.

def parse_from_environ(self, environ: WSGIEnvironment) -> t_parse_result: (source)

Parses the information from the environment as form data. :param environ: the WSGI environment to be used for parsing. :return: A tuple in the form ``(stream, form, files)``.

Undocumented

Undocumented

Undocumented

max_content_length = (source)

Undocumented

max_form_memory_size = (source)

Undocumented

max_form_parts = (source)

Undocumented

Undocumented

stream_factory = (source)

Undocumented

@exhaust_stream
def _parse_multipart(self, stream: t.IO[bytes], mimetype: str, content_length: t.Optional[int], options: t.Dict[str, str]) -> t_parse_result: (source)

Undocumented

@exhaust_stream
def _parse_urlencoded(self, stream: t.IO[bytes], mimetype: str, content_length: t.Optional[int], options: t.Dict[str, str]) -> t_parse_result: (source)

Undocumented