def _refresh_session_token_device(self, device: str): refresh_key = 'device.session:{}'.format(device) session = self.cache.get(refresh_key) if session: old_login = json.loads(session) device_id = old_login['uuid'] self.cache.delete(refresh_key) return generate_device_login(device_id, self.cache)
def _add_device(context): context.wake_word = add_wake_word(context.db) context.voice = add_text_to_speech(context.db) device_id = add_device(context.db, context.account.id, context.geography_id) context.device_id = device_id context.device_name = 'Selene Test Device' context.device_login = generate_device_login(device_id, context.cache) context.access_token = context.device_login['accessToken']
def _add_device(context): """Add a device object to the context for use in step code.""" context.voice = add_text_to_speech(context.db) device_id = add_device(context.db, context.account.id, context.geography_id) context.device_id = device_id context.device_name = "Selene Test Device" context.device_login = generate_device_login(device_id, context.cache) context.access_token = context.device_login["accessToken"]
def post(self): activation_request = self._validate_request() pairing_session = self._get_pairing_session() if pairing_session is not None: device_id = pairing_session['uuid'] self._activate(device_id, activation_request) response = (generate_device_login(device_id, self.cache), HTTPStatus.OK) else: response = '', HTTPStatus.NOT_FOUND return response