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, result_class=ParseResult, trim=False, bundle_errors=False)
 
def add_argument (self, *args, **kwargs)
 
def parse_args (self, req=None, strict=False)
 
def copy (self)
 
def replace_argument (self, name, *args, **kwargs)
 
def remove_argument (self, name)
 
def __schema__ (self)
 

Data Fields

 args
 
 argument_class
 
 result_class
 
 trim
 
 bundle_errors
 

Detailed Description

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

    from flask_restplus import RequestParser

    parser = 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,
  result_class = ParseResult,
  trim = False,
  bundle_errors = False 
)

Member Function Documentation

◆ __schema__()

def __schema__ (   self)

◆ 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 
)
Parse all arguments from the provided request and return the results as a ParseResult

:param bool strict: if req includes args not in parser, throw 400 BadRequest exception
:return: the parsed results as :class:`ParseResult` (or any class defined as :attr:`result_class`)
:rtype: ParseResult

◆ 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

◆ result_class

result_class

◆ trim

trim

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