#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import json
from flask import make_response


def api_response(responseObj, httpStatus=200):
    """Creates an json Response from an given Python Object

    Keyword arguments:
    responseObj -- Python Object
    httpStatus -- HTTP Response Code (default: 200 [OK])
    """
    r = make_response(json.dumps(responseObj, indent=4),httpStatus)
    r.headers["Content-Type"] = "application/json; charset=utf-8"
    return r

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import json
from flask import make_response


def api_response(responseObj, httpStatus=200):
    """Creates an json Response from an given Python Object

    Keyword arguments:
    responseObj -- Python Object
    httpStatus -- HTTP Response Code (default: 200 [OK])
    """
    r = make_response(json.dumps(responseObj, indent=4),httpStatus)
    r.headers["Content-Type"] = "application/json; charset=utf-8"
    r.headers["Access-Control-Allow-Origin"] = "*"
    return r

Allow XSS: *