OpenQuizz
Une application de gestion des contenus pédagogiques
|
Public Member Functions | |
def | json (self) |
def | is_json (self) |
def | get_json (self, force=False, silent=False, cache=True) |
def | on_json_loading_failed (self, e) |
Static Public Attributes | |
json_module | |
Mixin to parse :attr:`data` as JSON. Can be mixed in for both :class:`~werkzeug.wrappers.Request` and :class:`~werkzeug.wrappers.Response` classes. If `simplejson`_ is installed it is preferred over Python's built-in :mod:`json` module. .. _simplejson: https://simplejson.readthedocs.io/en/latest/
def get_json | ( | self, | |
force = False , |
|||
silent = False , |
|||
cache = True |
|||
) |
Parse :attr:`data` as JSON. If the mimetype does not indicate JSON (:mimetype:`application/json`, see :meth:`is_json`), this returns ``None``. If parsing fails, :meth:`on_json_loading_failed` is called and its return value is used as the return value. :param force: Ignore the mimetype and always try to parse JSON. :param silent: Silence parsing errors and return ``None`` instead. :param cache: Store the parsed JSON to return for subsequent calls.
def is_json | ( | self | ) |
Check if the mimetype indicates JSON data, either :mimetype:`application/json` or :mimetype:`application/*+json`.
def json | ( | self | ) |
The parsed JSON data if :attr:`mimetype` indicates JSON (:mimetype:`application/json`, see :meth:`is_json`). Calls :meth:`get_json` with default arguments.
def on_json_loading_failed | ( | self, | |
e | |||
) |
Called if :meth:`get_json` parsing fails and isn't silenced. If this method returns a value, it is used as the return value for :meth:`get_json`. The default implementation raises :exc:`~werkzeug.exceptions.BadRequest`.
|
static |