Fixes to the delete letter notifications.

If there are no files to delete we won't get an excpetion.
Wrap the delete file in a try/except to avoid stopping the entire task.
Fix the missing slash for the file name.
This commit is contained in:
Rebecca Law
2018-08-13 14:09:51 +01:00
parent bffef09d3d
commit f965322f25
3 changed files with 10 additions and 4 deletions

View File

@@ -61,7 +61,8 @@ def get_s3_bucket_objects(bucket_name, subfolder='', older_than=7, limit_days=2)
all_objects_in_bucket = []
for page in page_iterator:
all_objects_in_bucket.extend(page['Contents'])
if page.get('Contents'):
all_objects_in_bucket.extend(page['Contents'])
return all_objects_in_bucket