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

Public Member Functions

def __init__ (self, argument_class=Argument, namespace_class=Namespace, trim=False, bundle_errors=False)
 
def add_argument (self, *args, **kwargs)
 
def parse_args (self, req=None, strict=False, http_error_code=400)
 
def copy (self)
 
def replace_argument (self, name, *args, **kwargs)
 
def remove_argument (self, name)
 

Data Fields

 args
 
 argument_class
 
 namespace_class
 
 trim
 
 bundle_errors
 

Detailed Description

Enables adding and parsing of multiple arguments in the context of a
single request. Ex::

    from flask_restful import reqparse

    parser = reqparse.RequestParser()
    parser.add_argument('foo')
    parser.add_argument('int_bar', type=int)
    args = parser.parse_args()

:param bool trim: If enabled, trims whitespace on all arguments in this
    parser
:param bool bundle_errors: If enabled, do not abort when first error occurs,
    return a dict with the name of the argument and the error message to be
    bundled and return all validation errors

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  argument_class = Argument,
  namespace_class = Namespace,
  trim = False,
  bundle_errors = False 
)

Member Function Documentation

◆ add_argument()

def add_argument (   self,
args,
**  kwargs 
)
Adds an argument to be parsed.

Accepts either a single instance of Argument or arguments to be passed
into :class:`Argument`'s constructor.

See :class:`Argument`'s constructor for documentation on the
available options.

◆ copy()

def copy (   self)
Creates a copy of this RequestParser with the same set of arguments 

◆ parse_args()

def parse_args (   self,
  req = None,
  strict = False,
  http_error_code = 400 
)
Parse all arguments from the provided request and return the results
as a Namespace

:param req: Can be used to overwrite request from Flask
:param strict: if req includes args not in parser, throw 400 BadRequest exception
:param http_error_code: use custom error code for `flask_restful.abort()`

◆ remove_argument()

def remove_argument (   self,
  name 
)
Remove the argument matching the given name. 

◆ replace_argument()

def replace_argument (   self,
  name,
args,
**  kwargs 
)
Replace the argument matching the given name with a new version. 

Field Documentation

◆ args

args

◆ argument_class

argument_class

◆ bundle_errors

bundle_errors

◆ namespace_class

namespace_class

◆ trim

trim

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