def delete_batch_projection(self, batch_projection): """Deletes a batch projection. """ check_resource_type(batch_projection, BATCH_PROJECTION_PATH, message="A batch projection id is needed.") batch_projection_id = get_batch_projection_id(batch_projection) if batch_projection_id: return self._delete("%s%s" % (self.url, batch_projection_id))
def update_batch_projection(self, batch_projection, changes): """Updates a batch projection. """ check_resource_type(batch_projection, BATCH_PROJECTION_PATH, message="A batch projection id is needed.") batch_projection_id = get_batch_projection_id(batch_projection) if batch_projection_id: body = json.dumps(changes) return self._update("%s%s" % (self.url, batch_projection_id), body)
def download_batch_projection(self, batch_projection, filename=None): """Retrieves the batch projections file. Downloads projections, 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_projection, BATCH_PROJECTION_PATH, message="A batch projection id is needed.") batch_projection_id = get_batch_projection_id(batch_projection) if batch_projection_id: return self._download("%s%s%s" % (self.url, batch_projection_id, DOWNLOAD_DIR), filename=filename)
def get_batch_projection(self, batch_projection, query_string=''): """Retrieves a batch projection. The batch_projection parameter should be a string containing the batch_projection id or the dict returned by create_batch_projection. As batch_projection 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_projection values and state info available at the time it is called. """ check_resource_type(batch_projection, BATCH_PROJECTION_PATH, message="A batch projection id is needed.") batch_projection_id = get_batch_projection_id(batch_projection) if batch_projection_id: return self._get("%s%s" % (self.url, batch_projection_id), query_string=query_string)