def allow_cors(func):
    """This is a decorator which enable CORS for the specified endpoint."""
    def wrapper(*args, **kwargs):
        response.headers['Access-Control-Allow-Origin'] = '*'
        response.headers['Access-Control-Allow-Methods'] = \
            'PUT, GET, POST, DELETE, OPTIONS'
        response.headers['Access-Control-Allow-Headers'] = \
            'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token'
        return func(*args, **kwargs)
    return wrapper
def allow_cors ( func ) : def wrapper ( * args , ** kwargs ) : response . headers [ 'Access-Control-Allow-Origin' ] = '*' response . headers [ 'Access-Control-Allow-Methods' ] = 'PUT, GET, POST, DELETE, OPTIONS' response . headers [ 'Access-Control-Allow-Headers' ] = 'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token' return func ( * args , ** kwargs ) return wrapper
This is a decorator which enable CORS for the specified endpoint.