Beispiel #1
0
def vnd_error(error):
    """
        Creates vnd.error type error responses
        https://github.com/blongden/vnd.error
    """
    body = {"code": error["code"], "message": error["message"]}
    status_code = error.get("status_code", 500)
    response = JsonResponse()
    response.status_code = status_code
    response.set_data(body)
    return response
Beispiel #2
0
def create_200(body):
    """
        Creates a 200 response

        Args:
            body(dict): body of response.
    """
    response = JsonResponse()
    response.status_code = 200
    response.set_data(body)
    return response
Beispiel #3
0
def create_200(body):
    """
        Creates a 200 response

        Args:
            body(dict): body of response.
    """
    response = JsonResponse()
    response.status_code = 200
    response.set_data(body)
    return response
Beispiel #4
0
def vnd_error(error):
    """
        Creates vnd.error type error responses
        https://github.com/blongden/vnd.error
    """
    body = {
        "code": error["code"],
        "message": error["message"]
    }
    status_code = error.get("status_code", 500)
    response = JsonResponse()
    response.status_code = status_code
    response.set_data(body)
    return response