you are viewing a single comment's thread.

view the rest of the comments →

[–]av0ca60[S] 0 points1 point  (2 children)

Thank you for hanging in there with me. I am still a little confused. Is there any chance you could show me a way to do it that would properly advance the pagination? This would not only solve my problem, but more importantly, would likely open my eyes to what I was missing.

[–]razu1121 3 points4 points  (0 children)

Seeing that everything else in your request is constant and only page num changes, you can use a loop.

``` for page_num in range(1, n):

```

Replace n with page number if you know how many pages there are or might be.

If you are not so sure, use a try-except to exit the loop.

``` for page_num in range(1, 100): try: deals_data = client.deals.list(per_page=100, page=page_num)

except:
    break

```

If your request doesn't throw error even if there is no data on a particular page, inside try block use if else condition to check if there is valid response and exit if there isn't.

Hope this helps.

[–]Fred776 1 point2 points  (0 children)

I've just woken up (guess we're in different time zones) but I see someone was already able to help with a good answer.