Created
June 4, 2019 19:21
-
-
Save zhaowb/5c148a0a6f6d337f3259905b0f13e4ea to your computer and use it in GitHub Desktop.
stripe list paging incorrect with starting_after
This file contains 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
In [2]: pg1 = stripe.Invoice.list() | |
In [3]: pg2 = stripe.Invoice.list(starting_after=pg1.data[-1].id) | |
In [4]: pg2.data[0].id | |
Out[4]: 'in_1EgJwwDhOpaK71Z9NO4eU8Jz' | |
In [5]: invs100 = stripe.Invoice.list(limit=100) | |
In [6]: [i.id for i in invs100].index(pg2.data[0].id) | |
Out[6]: 42 | |
In [7]: [i.id for i in invs100].index(pg2.data[1].id) | |
Out[7]: 43 | |
In [8]: [i.id for i in invs100].index(pg2.data[2].id) | |
Out[8]: 44 | |
In [9]: [i.id for i in invs100].index(pg1.data[0].id) | |
Out[9]: 0 | |
In [10]: [i.id for i in invs100].index(pg1.data[1].id) | |
Out[10]: 1 | |
In [11]: [i.id for i in invs100].index(pg1.data[-1].id) | |
Out[11]: 9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment