def __init__(self, config): Cloud.__init__(self, "Axeda", config) if not config.get("name"): assert (False) if not config.get("api_key"): assert (False) if not config.get("asset"): assert (False) if not config.get("model"): assert (False) self.config = config self.api_key = config["api_key"] # Service Requires SSL self.ssl = config.get('ssl') self.debug = config["debug"] if config.get('debug') else False self.name_space = None # Always use v1 host = 'https://windriver.api.mashery.com/' self.url_prefix = host + config['name'] + '/services/v1/rest/'
def __init__(self, config): Cloud.__init__(self, "Axeda", config) if self.get('name') == None: assert(False) if self.get('username') == None: assert(False) if self.get('password') == None: assert(False) if not self.get("asset"): assert(False) if not self.get("model"): assert(False) self.config = config self.username = self.get('username') self.password = self.get('password') self.timeout = self.get('timeout') self.session_id = None if self.get('ssl') != None: self.ssl = self.get('ssl') else: self.ssl = None self.debug = config["debug"] if config.get('debug') else False # Use json or xml? if self.get('json') == None: self.json = True else: self.json = self.get('json') if self.ssl == True: self.v1_url_prefix = 'https' self.v2_url_prefix = 'https' else: self.v1_url_prefix = 'http' self.v2_url_prefix = 'http' self.v1_url_prefix += '://' + config['name'] + '/services/v1/rest/' self.v2_url_prefix += '://' + config['name'] + '/services/v2/rest/' if not self.json: self.name_space = 'http://type.v1.webservices.sl.axeda.com' ElementTree.register_namespace('', self.name_space) #ElementTree.register_namespace('xsi', "http://www.w3.org/2001/XMLSchema-instance") else: self.name_space = None