in sample-demo-app/aws_python_sample_application/task_publisher.py [0:0]
def _list_image_on_s3(self):
try:
print("Listing image in " + self.s3_bucket_name + " under " + SAMPLE_IMAGES_FOLDER)
response = self.s3_client.list_objects_v2(Bucket=self.s3_bucket_name, Prefix=SAMPLE_IMAGES_FOLDER)
objects_in_s3 = list(map(lambda x: x["Key"], response["Contents"]))
print("Listed image in " + self.s3_bucket_name + " under " + SAMPLE_IMAGES_FOLDER + " successfully.")
return list(filter(lambda x: x != SAMPLE_IMAGES_FOLDER, objects_in_s3))
except Exception:
print("Failed to list images in " + self.s3_bucket_name + " under " + SAMPLE_IMAGES_FOLDER)
return []