From 39339ec9d8e87d6fe2e042d5d87d4e5dd116c18d Mon Sep 17 00:00:00 2001 From: Fuhu Xia Date: Mon, 18 Sep 2023 12:49:50 -0400 Subject: [PATCH] correct s3 delete-objects --- ckanext/geodatagov/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ckanext/geodatagov/cli.py b/ckanext/geodatagov/cli.py index 16c90052..562c3fd6 100644 --- a/ckanext/geodatagov/cli.py +++ b/ckanext/geodatagov/cli.py @@ -206,12 +206,12 @@ def upload_to_key(upload_str: str, filename_on_s3: str) -> None: def delete_old_sitemaps(): - objects_to_delete = S3.meta.client.list_objects(Bucket=BUCKET_NAME, Prefix=PREFIX) + objects_to_delete = S3.list_objects(Bucket=BUCKET_NAME, Prefix=PREFIX) delete_keys = {'Objects': []} delete_keys['Objects'] = [{'Key': k} for k in [obj['Key'] for obj in objects_to_delete.get('Contents', [])]] - S3.meta.client.delete_objects(Bucket=BUCKET_NAME, Delete=delete_keys) + S3.delete_objects(Bucket=BUCKET_NAME, Delete=delete_keys) def upload_sitemap_file(sitemap: list) -> None: