pipedrive-python
pipedrive-python copied to clipboard
Pagination of Results
I'm running the .get_all_deals_with_filter() function and have pagination within the results. (I'm only getting the first 100 and it is saying there are more results.) How do I update this to get those additional "pages" of results? It appears that I can only pass the filter_id into the function without error, unless I'm doing something wrong.
You can increase limit. I think max was 500. And then you have to write an iterator which goes over the pages.
Quick example:
r = client.get_all_deals_with_filter({"limit" :500,}) # first query
while r['additional_data']["pagination"]: # iterator
for item in r["data"]:
# "do something with your items"
if not r['additional_data']["pagination"]['more_items_in_collection']: # check if there are no more pages
break
r = client.organizations.get_all_deals_with_filter({"limit" :500, "start": r['additional_data']["pagination"]["next_start"]}) # next query