def cors_header ( func ) : @ wraps ( func ) def wrapper ( self , request , * args , * * kwargs ) : res = func ( self , request , * args , * * kwargs ) request . setHeader ( 'Access-Control-Allow-Origin' , '*' ) request . setHeader ( 'Access-Control-Allow-Headers' , 'Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With' ) return res return wrapper
python flask header cors allow
def cors_header(func):
    """ @cors_header decorator adds CORS headers """

    @wraps(func)
    def wrapper(self, request, *args, **kwargs):
        res = func(self, request, *args, **kwargs)
        request.setHeader('Access-Control-Allow-Origin', '*')
        request.setHeader('Access-Control-Allow-Headers', 'Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With')
        return res

    return wrapper