def login_and_get_status(self): namespaces = {'ns2':'urn:com:airbiquity:smartphone.userservices:v1'} d = {'SmartphoneLoginInfo': { 'UserLoginInfo': { 'userId': self.connection.username, 'userPassword': self.connection.password }, 'DeviceToken': 'DUMMY%f' % time.time(), 'UUID': sha.sha("carwings_api:%s" % self.connection.username).hexdigest(), 'Locale': 'US', 'AppVersion': '1.40', 'SmartphoneType': 'IPHONE'}, 'SmartphoneOperationType': 'SmartphoneLatestBatteryStatusRequest'} xml = dict_to_xml(d, 'ns2:SmartphoneLoginWithAdditionalOperationRequest', namespaces) result = self.connection.post_xml(self.SERVICE_PATH, xml) status = LoginStatus(result) if status.logged_in: self.connection.logged_in = True else: self.connection.logged_in = False return status
def login_and_get_status(self): namespaces = {'ns2': 'urn:com:airbiquity:smartphone.userservices:v1'} d = { 'SmartphoneLoginInfo': { 'UserLoginInfo': { 'userId': self.connection.username, 'userPassword': self.connection.password }, 'DeviceToken': 'DUMMY%f' % time.time(), 'UUID': sha.sha("carwings_api:%s" % self.connection.username).hexdigest(), 'Locale': 'US', 'AppVersion': '1.40', 'SmartphoneType': 'IPHONE' }, 'SmartphoneOperationType': 'SmartphoneLatestBatteryStatusRequest' } xml = dict_to_xml(d, 'ns2:SmartphoneLoginWithAdditionalOperationRequest', namespaces) result = self.connection.post_xml(self.SERVICE_PATH, xml) status = LoginStatus(result) if status.logged_in: self.connection.logged_in = True else: self.connection.logged_in = False return status
def get_latest_status(self, vin): if not self.connection.logged_in: raise AuthException('Please log in before checking status') namespaces = {'ns2':'urn:com:airbiquity:smartphone.userservices:v1'} d = {'VehicleInfo': {'Vin': vin}, 'SmartphoneOperationType': 'SmartphoneLatestBatteryStatusRequest', 'changeVehicle': 'false'} xml = dict_to_xml(d, 'ns2:SmartphoneGetVehicleInfoRequest', namespaces) result = self.connection.post_xml(self.SERVICE_PATH, xml) return LatestBatteryStatus(result)
def get_latest_status(self, vin): if not self.connection.logged_in: raise AuthException('Please log in before checking status') namespaces = {'ns2': 'urn:com:airbiquity:smartphone.userservices:v1'} d = { 'VehicleInfo': { 'Vin': vin }, 'SmartphoneOperationType': 'SmartphoneLatestBatteryStatusRequest', 'changeVehicle': 'false' } xml = dict_to_xml(d, 'ns2:SmartphoneGetVehicleInfoRequest', namespaces) result = self.connection.post_xml(self.SERVICE_PATH, xml) return LatestBatteryStatus(result)
def _post(self, data, root_node): xml = dict_to_xml(data, root_node, VehicleService.namespaces) self.connection.post_xml(self.SERVICE_PATH, xml, True) return True