Ejemplo n.º 1
0
def stored_cache():
    scenario = request.args.get('scenario')
    #get the input
    print('Scenario: ',scenario)
    if scenario != '':
        try:
            #initiate the query cache process
            querycacheobj = QueryCache(scenario)
            fnlqrycachejson = querycacheobj.searchquery()

            if (fnlqrycachejson['data'] != ''):
                return constructresp(200, 42, 'SUCCESS', scenario, fnlqrycachejson['data'])
            else:
                return constructresp(400, 42, 'QUERY_CACHE_ERROR', scenario, fnlqrycachejson['error'])
        except ValueError:
            return constructresp(400, 42, 'QUERY_CACHE_ERROR', scenario, 'Application unable to process the input')
    else:
        return constructresp(400, 42, 'MISSING_SCENARIO', scenario, 'Empty \'scenario\' paramater')
Ejemplo n.º 2
0
def findqueryusingscenario(scenario):
    output = {'data': '' ,'error': ''}
    if scenario != '':
        try:
            #initiate the query cache process
            querycacheobj = QueryCache(scenario)
            fnlqrycachejson = querycacheobj.searchquery()

            if (fnlqrycachejson['data'] != ''):
                output['data'] = fnlqrycachejson['data']
            else:
                output['error'] = fnlqrycachejson['error']
            return output
        except ValueError:
            output['error'] = 'QUERY_CACHE_ERROR'
            return output          
    else:
        output['error'] = 'MISSING_SCENARIO'
        return output