def get_slot_name(self): if Utils.checkKeysInDict(self.data, ['response', 'directives']): directive = self.data['response']['directives'] if directive and Utils.checkKeysInDict( directive[0], ['slotToElicit']) and directive[0]['slotToElicit']: return directive[0]['slotToElicit'] return None
def get_location(self): if Utils.checkKeysInDict( self.data, ['context', 'System', 'user', 'userInfo', 'location', 'geo']): return self.data['context']['System']['user']['userInfo'][ 'location']['geo'] return None
def get_botid(self): if Utils.checkKeysInDict( self.data, ['context', 'System', 'application', 'applicationId']): return self.data['context']['System']['application'][ 'applicationId'] return None
def getUserInfo(self): ''' :return: ''' if Utils.checkKeysInDict(self.data, ['user_info']): return self.data['user_info'] return None
def get_app_launcher_context(self): ''' 获取设备app安装列表 :return: ''' if Utils.checkKeysInDict(self.data, ['context', 'AppLauncher']): return self.data['context']['AppLauncher'] return None
def get_audio_player_context(self): ''' 获取设备音频播放的状态 :return: ''' if Utils.checkKeysInDict(self.data, ['context', 'AudioPlayer']): return self.data['context']['AudioPlayer'] return None
def is_dialog_state_completed(self): if Utils.checkKeysInDict(self.data, ['request', 'dialogState']): return self.data['request']['dialogState'] == 'COMPLETED' return False
def get_user_id(self): if Utils.checkKeysInDict(self.data, ['context', 'System', 'user', 'userId']): return self.data['context']['System']['user']['userId'] return None
def get_device_id(self): if Utils.checkKeysInDict(self.data, ['context', 'System', 'device', 'deviceId']): return self.data['context']['System']['device']['deviceId'] return None
def get_session_id(self): if Utils.checkKeysInDict(self.data, ['session', 'sessionId']): return self.data['session']['sessionId'] return None
def get_reson(self): if Utils.checkKeysInDict(self.data, ['request', 'reason']): return self.data['request']['reason'] return None
def get_timestamp(self): if Utils.checkKeysInDict(self.data, ['request', 'timestamp']): return self.data['request']['timestamp'] return None
def getReprompt(self): if Utils.checkKeysInDict(self.data, ['response', 'reprompt', 'outputSpeech']): return self.data['response']['reprompt']['outputSpeech'] return None
def getShouldEndSession(self): if Utils.checkKeysInDict(self.data, ['response', 'shouldEndSession']): return self.data['response']['shouldEndSession'] pass
def getOutputSpeech(self): if Utils.checkKeysInDict(self.data, ['response', 'outputSpeech']): return self.data['response']['outputSpeech']
def getRequestId(self): if Utils.checkKeysInDict(self.data, ['request', 'requestId']): return self.data['request']['requestId'] return None