Last active
December 10, 2020 02:53
-
-
Save kachina/3fb3489a765f58001fb13bb7337a719f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import os | |
import boto3 | |
def main(): | |
s3_client = boto3.client('s3') | |
params = {'Bucket': 'example-bucket'} | |
while True: | |
response = s3_client.list_objects_v2(**params) | |
for content in response['Contents']: | |
print(content['Key']) | |
if 'NextContinuationToken' not in response: | |
break | |
params['ContinuationToken'] = response['NextContinuationToken'] | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment