Miscellaneous

common.RET_ENTITIES_DEF_LIMIT = 100

Default number of returned entities.

common.RET_ENTITIES_MAX_LIMIT = 1000

Maximum number of returned entities.

common.create_response(code: int, body: List[dict] | dict) Dict[str, Any]

Create a response from some status code and response body.

The format of a standard response from any Flask API route is:

{
    'code': <number>,
    'body': [
        <zero or more of models.Model>
        ...
    ]
}
See also:

models.Model

common.is_dirty(value: str) bool

Check if the passed string contains dangerous characters.

Permitted characters/character ranges:

  • Uppercase letters [A-Z]

  • Lowercase letters [a-z]

  • Numbers [0-9]

  • Hyphen (-)

  • Underscore (_)

  • Backslash ()

  • Forward slash (/)

  • Period (.)

  • Comma (,)

  • Equals sign (=)

All other characters are considered dangerous.

Returns:

True if the string contains dangerous characters, else False.