smsframework/providers/forward/provider.py
def jsonex_api(f):
    """ View wrapper for JsonEx responses. Catches exceptions as well """
    @wraps(f)
    def wrapper(*args, **kwargs):
        # Call, catch exceptions
        try:
            code, res = 200, f(*args, **kwargs)
        except HTTPException as e:
            code, res = e.code, {'error': e}
        except Exception as e:
            code, res = 500, {'error': e}
            logger.exception('Method error')

        # Response
        response = make_response(jsonex_dumps(res), code)
        response.headers['Content-Type'] = 'application/json'
        return response
    return wrapper
def jsonex_api(f):
    """ View wrapper for JsonEx responses. Catches exceptions as well """
    @wraps(f)
    def wrapper(*args, **kwargs):
        # Call, catch exceptions
        try:
            code, res = 200, f(*args, **kwargs)
        except HTTPException as e:
            code, res = e.code, {'error': e}
        except Exception as e:
            code, res = 500, {'error': e}
            logger.exception('Method error')

        # Response
        response = make_response(jsonex_dumps(res), code)
        response.headers['Content-Type'] = 'application/json'
        return response
    return wrapper
def jsonex_api ( f ) : @ wraps ( f ) def wrapper ( * args , * * kwargs ) : # Call, catch exceptions try : code , res = 200 , f ( * args , * * kwargs ) except HTTPException as e : code , res = e . code , { 'error' : e } except Exception as e : code , res = 500 , { 'error' : e } logger . exception ( 'Method error' ) # Response response = make_response ( jsonex_dumps ( res ) , code ) response . headers [ 'Content-Type' ] = 'application/json' return response return wrapper
View wrapper for JsonEx responses. Catches exceptions as well
View wrapper for JsonEx responses . Catches exceptions as well