#Niekas-pagination

1 messages ยท Page 1 of 1 (latest)

knotty dust
west kernel
#

Can you describe where exactly you're encountering an issue?

dim badger
#

alrighty, i will give an example

#

im using the following to retrieve the disputes and then use functions to submit the evidence. Now the problem is that we had more than a 100 disputes in place, using it I submitted the evidence for the first 100, and now cant reach the rest.

#

dispute = stripe.Dispute.list(limit=100)

n = 0
while n < 100:

disputeID = dispute['data'][n]['id']
#

as I understand Stripe has a maximum of 100 objects in the list, all good, but how exactly do I reach the other 100 disputes etc.?

#

I never had this issue before because we never had more than a few disputes and stripe always puts the newest one at [0] :X any help is much appreciated โค๏ธ

west kernel
#

This is what the starting_after and ending_before parameters control for paginations - where in the list are you looking

#

so if you had more than 100, eg, you'd take the last entry you get in the 100 say di_123 and then make another list request with starting_after=di_123 to get the next 100

#

and so on

#

or, you the auto-pagination and iterate through the results instead of using explicit array index access

#

then the library will handle the pagination for you (if it supports it, which python does)

#
disputes = stripe.Dispute.list(limit=3)
for dispute in disputes.auto_paging_iter():
  # Do something with dispute
dim badger
#

ohh this is great! I just also figured that picking the ones with "needs_response" also works as a way around ๐Ÿ™‚ thanks for the help!