A data container for request body parameters. :param name: The name of this request field. Must be unicode. :param data: The data/value body. :param filename: An optional filename of the request field. Must be unicode. :param headers: An optional dict-like object of headers to initially use for the field. :param header_formatter: An optional callable that is used to encode and format the headers. By default, this is :func:`format_header_param_html5`.
Class Method | from |
A :class:`~urllib3.fields.RequestField` factory from old-style tuple parameters. |
Method | __init__ |
Undocumented |
Method | make |
Makes this request field into a multipart request field. |
Method | render |
Renders the headers for this request field. |
Instance Variable | data |
Undocumented |
Instance Variable | header |
Undocumented |
Instance Variable | headers |
Undocumented |
Method | _render |
Overridable helper function to format a single header parameter. By default, this calls ``self.header_formatter``. |
Method | _render |
Helper function to format and quote a single header. |
Instance Variable | _filename |
Undocumented |
Instance Variable | _name |
Undocumented |
def from_tuples(cls, fieldname, value, header_formatter=format_header_param_html5): (source) ¶
A :class:`~urllib3.fields.RequestField` factory from old-style tuple parameters. Supports constructing :class:`~urllib3.fields.RequestField` from parameter of key/value strings AND key/filetuple. A filetuple is a (filename, data, MIME type) tuple where the MIME type is optional. For example:: 'foo': 'bar', 'fakefile': ('foofile.txt', 'contents of foofile'), 'realfile': ('barfile.txt', open('realfile').read()), 'typedfile': ('bazfile.bin', open('bazfile').read(), 'image/jpeg'), 'nonamefile': 'contents of nonamefile field', Field names and filenames must be unicode.
Undocumented
Makes this request field into a multipart request field. This method overrides "Content-Disposition", "Content-Type" and "Content-Location" headers to the request parameter. :param content_type: The 'Content-Type' of the request body. :param content_location: The 'Content-Location' of the request body.
Overridable helper function to format a single header parameter. By default, this calls ``self.header_formatter``. :param name: The name of the parameter, a string expected to be ASCII only. :param value: The value of the parameter, provided as a unicode string.