Created
April 27, 2017 09:01
-
-
Save dsaiztc/65d3489fc952b2091582cd7dd6430c45 to your computer and use it in GitHub Desktop.
Boto3 tricks.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def list_objects_s3(s3_client, s3_bucket, s3_prefix): | |
"""List objects in S3 overcoming the limit of 1000 per usual request.""" | |
s3_paginator = s3_client.get_paginator('list_objects') | |
page_iterator = s3_paginator.paginate(Bucket=s3_bucket, Prefix=s3_prefix) | |
for page in page_iterator: | |
object_list = page.get('Contents') | |
for object in object_list: | |
yield object |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment