示例#1
0
    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
示例#2
0
    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
示例#3
0
    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)
示例#4
0
    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
示例#6
0
    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