Represents a JSON array in Python.
alias of list
Represents a JSON object in Python.
alias of dict
Deserializes JSON from a file-like stream.
This function deserializes JSON from a stream, including translating read and parsing errors to HTTP error types.
Parameters: |
|
---|---|
Raises: | HTTPBadRequest, HTTPServiceUnavailable |
Validates and retrieves typed fields from a single document.
Sanitizes a dict-like document by checking it against a list of field spec, and returning only those fields specified.
Parameters: |
|
---|---|
Raises: | HTTPBadRequest if any field is missing or not an instance of the specified type |
Returns: | A filtered dict containing only the fields listed in the spec |
Validates and retrieves a typed field from a document.
This function attempts to look up doc[name], and raises appropriate HTTP errors if the field is missing or not an instance of the given type.
Parameters: |
|
---|---|
Raises: | HTTPBadRequest if the field is missing or not an instance of value_type |
Returns: | value obtained from doc[name] |
Reads request body, raising an exception if it is not JSON.
Parameters: | req (falcon.Request) – The request object to read from |
---|---|
Returns: | a dictionary decoded from the JSON stream |
Return type: | dict |
Raises: | errors.HTTPBadRequestBody |
Validates a document and drops undesired fields.
Parameters: |
|
---|---|
Raises: | HTTPBadRequestBody |
Returns: | A sanitized, filtered version of the document. If the document is a list of objects, each object will be filtered and returned in a new list. If, on the other hand, the document is expected to contain a single object, that object’s fields will be filtered and the resulting object will be returned. |
Verifies a document against a schema.
Parameters: |
|
---|---|
Raises: | errors.HTTPBadRequestBody |