def send_batch(batch, args): auth = get_auth_headers() client = tagging.Client(auth['X-CH-Auth-Email'], auth['X-CH-Auth-API-Token']) logger.info('Submitting batch') guid = client.submit_populator_batch(args.name, batch) # wait up to 60 seconds for the batch to finish: for _ in range(1, 12): time.sleep(1) status = client.fetch_batch_status(guid) logger.info('Checking batch progress, Finish = %s', status.is_finished()) if status.is_finished(): print("is_finished: %s" % str(status.is_finished())) print("upsert_error_count: %s" % str(status.invalid_upsert_count())) print("delete_error_count: %s" % str(status.invalid_delete_count())) print() print(status.pretty_response()) break
from kentikapi.v5 import tagging # # Example: Delete all populators for a HyperScale custom dimension # # This creates an empty batch of populators for a HyperScale custom dimension, # replacing everything that's already there with... nothing, since we don't define # any populators in the batch. # # --------------------------------------------------- # Change these options: option_api_email = '*****@*****.**' option_api_token = '123456d77afce9c33c09f8b88b52ff38' option_custom_dimension = 'c_my_column' # --------------------------------------------------- # ----- # initialize a batch that will replace all populators # ----- batch = tagging.Batch(True) # no populators entered, so everything just gets deleted # ----- # Showtime! Submit the batch as populators for the configured custom dimension # ----- client = tagging.Client(option_api_email, option_api_token) client.submit_populator_batch(option_custom_dimension, batch)