OpenQuizz
Une application de gestion des contenus pédagogiques
RequestField Class Reference
Inheritance diagram for RequestField:
Collaboration diagram for RequestField:

Public Member Functions

def __init__ (self, name, data, filename=None, headers=None, header_formatter=format_header_param_html5)
 
def from_tuples (cls, fieldname, value, header_formatter=format_header_param_html5)
 
def render_headers (self)
 
def make_multipart (self, content_disposition=None, content_type=None, content_location=None)
 

Data Fields

 data
 
 headers
 
 header_formatter
 

Detailed Description

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`.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  name,
  data,
  filename = None,
  headers = None,
  header_formatter = format_header_param_html5 
)

Member Function Documentation

◆ from_tuples()

def from_tuples (   cls,
  fieldname,
  value,
  header_formatter = format_header_param_html5 
)
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.

◆ make_multipart()

def make_multipart (   self,
  content_disposition = None,
  content_type = None,
  content_location = None 
)
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.

◆ render_headers()

def render_headers (   self)
Renders the headers for this request field.

Field Documentation

◆ data

data

◆ header_formatter

header_formatter

◆ headers

headers

The documentation for this class was generated from the following file: