response_format

Provides functionality for handling the response format.

Examples

If you want to validate a dictionary against the response format:

>>> from data_formats import response_format
>>> example = {}
>>> response_format.validate(example)
Traceback (most recent call last):

data_formats.response_format.ResponseValidationError

exception data_formats.response_format.ResponseValidationError[source]

The instance failed to validate against the SCHEMA.

data_formats.response_format.create_response(status: Status, model: Dict) Dict[str, Any][source]

Create a new response format dictionary.

Parameters:
  • status – The status of the problem

  • model – A dictionary of the variables and their values that were used in the model

data_formats.response_format.validate(instance: dict) None[source]

Validate the instance against the schema.

Parameters:

instance – The potential instance of the schema

Raises:

ValidationError – the instance does not match the schema