def build_endpoint_prefix(self): """This constructs everything to the left of the file path in the URL. """ if not sanity.validate_api_hostname(self.api_host): error_message = "Bad API hostname: %s" % self.api_host raise CloudPassageValidation(error_message) prefix = "https://" + self.api_host + ":" + str(self.api_port) return prefix
def set_config_variables(self, config_variables): """Sets configuration vars for object""" self.key_id = config_variables["key_id"] self.secret_key = config_variables["secret_key"] if sanity.validate_api_hostname(config_variables["api_hostname"]): self.api_hostname = config_variables["api_hostname"] try: if 65535 > int(config_variables["api_port"]) > 0: self.api_port = int(config_variables["api_port"]) except: self.api_port = 443 return