Created
July 30, 2019 17:04
-
-
Save stewmi/78a2e1a5068ecffc19d91addbfd9c86b to your computer and use it in GitHub Desktop.
Boto3 Pagination
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 boto3 | |
# Create a client | |
client = boto3.client('s3', region_name='us-west-2') | |
# Create a reusable Paginator | |
paginator = client.get_paginator('list_objects') | |
# Create a PageIterator from the Paginator | |
page_iterator = paginator.paginate(Bucket='my-bucket') | |
for page in page_iterator: | |
print(page['Contents']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment