Skip to content

Instantly share code, notes, and snippets.

@gsweene2
Last active August 27, 2022 03:00
Show Gist options
  • Save gsweene2/d253c8cea4afa501ba31490b47455cb3 to your computer and use it in GitHub Desktop.
Save gsweene2/d253c8cea4afa501ba31490b47455cb3 to your computer and use it in GitHub Desktop.
class S3Util:
def __init__(self, s3_client):
self.s3_client = s3_client
def list_objects(self, bucket_name, jmes_exp=None):
paginator = self.s3_client.get_paginator("list_objects")
response = paginator.paginate(Bucket=bucket_name, PaginationConfig={}).build_full_result()
if jmes_exp:
response = response.search(jmes_exp)
return response["Contents"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment