def _set_api_urls(self, dev_mode=False, domain=None): """Sets the urls that point to the REST api methods for each resource dev_mode` has been deprecated. Now all resources coexist in the same production environment. Existing resources generated in development mode have been archived under a special project and are now accessible in production mode. """ if dev_mode: LOGGER.warning("Development mode is deprecated and the dev_mode" " flag will be removed soon.") if domain is None: domain = Domain() elif isinstance(domain, basestring): domain = Domain(domain=domain) elif not isinstance(domain, Domain): raise ValueError("The domain must be set using a Domain object.") # Setting the general and prediction domain options self.general_domain = domain.general_domain self.general_protocol = domain.general_protocol self.prediction_domain = domain.prediction_domain self.prediction_protocol = domain.prediction_protocol self.verify = domain.verify self.verify_prediction = domain.verify_prediction self.url = BIGML_URL % (BIGML_PROTOCOL, self.general_domain) self.prediction_url = BIGML_URL % (self.prediction_protocol, self.prediction_domain)
def _set_api_urls(self, dev_mode=False, domain=None): """Sets the urls that point to the REST api methods for each resource """ if domain is None: domain = Domain() elif isinstance(domain, basestring): domain = Domain(domain=domain) elif not isinstance(domain, Domain): raise ValueError("The domain must be set using a Domain object.") # Setting the general and prediction domain options self.general_domain = domain.general_domain self.general_protocol = domain.general_protocol self.prediction_domain = domain.prediction_domain self.prediction_protocol = domain.prediction_protocol self.verify = domain.verify self.verify_prediction = domain.verify_prediction if dev_mode: self.url = BIGML_DEV_URL % (self.general_protocol, self.general_domain) self.prediction_url = BIGML_DEV_URL % (self.general_protocol, self.general_domain) else: # Using a different prediction domain and protocol only in # production mode. Dev-mode uses the general values. self.url = BIGML_URL % (BIGML_PROTOCOL, self.general_domain) self.prediction_url = BIGML_URL % (self.prediction_protocol, self.prediction_domain)