Skip to content

Instantly share code, notes, and snippets.

@idling-mind
Last active July 15, 2020 22:54
Show Gist options
  • Save idling-mind/77ae720246f80a14e31249652cc26846 to your computer and use it in GitHub Desktop.
Save idling-mind/77ae720246f80a14e31249652cc26846 to your computer and use it in GitHub Desktop.
items = []
nextpagetoken = None
# The default number of media items to return at a time is 25. The maximum pageSize is 100.
while nextpagetoken != '':
print(f"Number of items processed:{len(items)}", end='\r')
results = google_photos.mediaItems().list(pageSize=100, pageToken=nextpagetoken).execute()
items += results.get('mediaItems', [])
nextpagetoken = results.get('nextPageToken', '')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment