def getSamples(userId): global stData print "ABOUT TO GENERATE NEW SAMPLES 1" currentClient = stData.getUser(userId) clientInfo = currentClient.getClientInfo() mode_uri = clientInfo.api_location + clientInfo.url + "/mode" mode_header = { "Authorization": clientInfo.token_type + " " + clientInfo.token } #get list of modes modeList = requests.get(mode_uri, headers=mode_header).json() switch_uri = clientInfo.api_location + clientInfo.url + "/switch" switch_header = { "Authorization": clientInfo.token_type + " " + clientInfo.token } switchList = requests.get(switch_uri, headers=switch_header).json() print "ABOUT TO GENERATE NEW SAMPLES 2" phrase_uri = clientInfo.api_location + clientInfo.url + "/phrase" phrase_header = { "Authorization": clientInfo.token_type + " " + clientInfo.token } phraseList = requests.get(phrase_uri, headers=phrase_header).json() print "ABOUT TO GENERATE NEW SAMPLES" return sampleGen.gen_all(modeList,switchList, phraseList)
def getSamples(userId): global mongoST clientInfo = mongoST.find_one({'st_amazonEchoID':userId}) mode_uri = clientInfo['st_api_location'] + clientInfo['st_url'] + "/mode" mode_header = { "Authorization": clientInfo['st_token_type'] + " " + clientInfo['st_access_token'] } #get list of modes modeList = requests.get(mode_uri, headers=mode_header).json() switch_uri = clientInfo['st_api_location'] + clientInfo['st_url'] + "/switch" switch_header = { "Authorization": clientInfo['st_token_type'] + " " + clientInfo['st_access_token'] } switchList = requests.get(switch_uri, headers=switch_header).json() phrase_uri = clientInfo['st_api_location'] + clientInfo['st_url'] + "/phrase" phrase_header = { "Authorization": clientInfo['st_token_type'] + " " + clientInfo['st_access_token'] } phraseList = requests.get(phrase_uri, headers=phrase_header).json() return sampleGen.gen_all(modeList,switchList, phraseList)
def getSamples(userId): global mongoST clientInfo = mongoST.find_one({'st_amazonEchoID': userId}) mode_uri = clientInfo['st_api_location'] + clientInfo['st_url'] + "/mode" mode_header = { "Authorization": clientInfo['st_token_type'] + " " + clientInfo['st_access_token'] } #get list of modes modeList = requests.get(mode_uri, headers=mode_header).json() switch_uri = clientInfo['st_api_location'] + clientInfo[ 'st_url'] + "/switch" switch_header = { "Authorization": clientInfo['st_token_type'] + " " + clientInfo['st_access_token'] } switchList = requests.get(switch_uri, headers=switch_header).json() phrase_uri = clientInfo['st_api_location'] + clientInfo[ 'st_url'] + "/phrase" phrase_header = { "Authorization": clientInfo['st_token_type'] + " " + clientInfo['st_access_token'] } phraseList = requests.get(phrase_uri, headers=phrase_header).json() return sampleGen.gen_all(modeList, switchList, phraseList)