Skip to content

Instantly share code, notes, and snippets.

@gsweene2
Created August 27, 2022 03:15
Show Gist options
  • Save gsweene2/c169d35d84c074e6179a2acc1d2d3022 to your computer and use it in GitHub Desktop.
Save gsweene2/c169d35d84c074e6179a2acc1d2d3022 to your computer and use it in GitHub Desktop.
import boto3
class S3Util:
def __init__(self):
self.s3_client = boto3.client("s3")
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