示例#1
0
def resource_not_found(func_url):
    res = {
        'error': {
            'errors': [
                {
                    'domain': 'global',
                    'reason': 'notFound',
                    'message': 'The resource \'' + urllib.unquote_plus(func_url) + '\' was not found'
                }
            ],
            'code': 404,
            'message': 'The resource \'' + urllib.unquote_plus(func_url) + '\' was not found'
        }
    }

    return helpers.create_errored_response(res, 404)
示例#2
0
def unauthorized(e):
    res = {
        'error': {
            'errors': [
                {
                    'domain': 'global',
                    'reason': 'required',
                    'message': 'Login Required',
                    'locationType': 'header',
                    'location': 'Authorization',
                },
            ],
        },
        'code': 401,
        'message': 'Login Required',
    }

    return helpers.create_errored_response(res, 401)