def delete_batch_topic_distribution(self, batch_topic_distribution): """Deletes a batch topic distribution. """ check_resource_type(batch_topic_distribution, BATCH_TOPIC_DISTRIBUTION_PATH, message="A batch topic distribution id is needed.") batch_topic_distribution_id = get_batch_topic_distribution_id( \ batch_topic_distribution) if batch_topic_distribution_id: return self._delete("%s%s" % (self.url, batch_topic_distribution_id))
def update_batch_topic_distribution(self, batch_topic_distribution, changes): """Updates a batch topic distributions. """ check_resource_type(batch_topic_distribution, BATCH_TOPIC_DISTRIBUTION_PATH, message="A batch topic distribution id is needed.") batch_topic_distribution_id = get_batch_topic_distribution_id( \ batch_topic_distribution) if batch_topic_distribution_id: body = json.dumps(changes) return self._update( "%s%s" % (self.url, batch_topic_distribution_id), body)
def update_batch_topic_distribution(self, batch_topic_distribution, changes): """Updates a batch topic distributions. """ check_resource_type(batch_topic_distribution, BATCH_TOPIC_DISTRIBUTION_PATH, message="A batch topic distribution id is needed.") batch_topic_distribution_id = get_batch_topic_distribution_id( \ batch_topic_distribution) if batch_topic_distribution_id: body = json.dumps(changes) return self._update("%s%s" % (self.url, batch_topic_distribution_id), body)
def download_batch_topic_distribution(self, batch_topic_distribution, filename=None): """Retrieves the batch topic distribution file. Downloads topic distributions, that are stored in a remote CSV file. If a path is given in filename, the contents of the file are downloaded and saved locally. A file-like object is returned otherwise. """ check_resource_type(batch_topic_distribution, BATCH_TOPIC_DISTRIBUTION_PATH, message="A batch topic distribution id is needed.") batch_topic_distribution_id = get_batch_topic_distribution_id( \ batch_topic_distribution) if batch_topic_distribution_id: return self._download("%s%s%s" % \ (self.url, batch_topic_distribution_id, DOWNLOAD_DIR), \ filename=filename)
def get_batch_topic_distribution(self, batch_topic_distribution, query_string=''): """Retrieves a batch topic distribution. The batch_topic_distribution parameter should be a string containing the batch_topic_distribution id or the dict returned by create_batch_topic_distribution. As batch_topic_distribution is an evolving object that is processed until it reaches the FINISHED or FAULTY state, the function will return a dict that encloses the batch_topic_distribution values and state info available at the time it is called. """ check_resource_type(batch_topic_distribution, BATCH_TOPIC_DISTRIBUTION_PATH, message="A batch topic distribution id is needed.") batch_topic_distribution_id = get_batch_topic_distribution_id( \ batch_topic_distribution) if batch_topic_distribution_id: return self._get("%s%s" % (self.url, batch_topic_distribution_id), query_string=query_string)