Skip to content

Instantly share code, notes, and snippets.

@adamjstevenson
Created November 12, 2016 17:18
Show Gist options
  • Save adamjstevenson/d40abd2659f83f900771a7fdc82cb494 to your computer and use it in GitHub Desktop.
Save adamjstevenson/d40abd2659f83f900771a7fdc82cb494 to your computer and use it in GitHub Desktop.
Stripe: Auto-paginate and print charge IDs
import stripe
stripe.api_key = "YOUR-TEST-KEY"
# Retrieve all charges
charges = stripe.Charge.all(limit=100)
# Use auto-pagination to iterate through them
for charge in charges.auto_paging_iter():
# Output charge IDs
print(charge.id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment