Hi, I’m working on exporting all Asana tasks to a csv file, which currently works well:
However, to future proof it I believe I need to implement some form of pagination. I’ve read the documentation on pagination but it leaves you without an example of how to implement this.
Something to do with the below line of code, but then what? Is that enough? Surely not…
client.options[‘page_size’] = 10
Can anyone point me in the right direction on how to paginate and loop through using Python? Many thanks,
In the Node library the pagination was kinda built in, did you browse the Python library looking for the word “pagination”? cc @Diakoptis@Phil_Seeman who are the best with the API
All of the Asana client libraries have paging built into them; you don’t need to do anything about it. The library handles the paging and returns to you all of the items you’ve asked for in your request.
The default page size is 50 items; you can set a smaller or larger value, up to a max of 100, but odds are you probably don’t need to vary from the default size. The page size is just an internal “number of items per request”; the only impact a specific number will have is in how many API calls are needed to get all of the data.
Great, so it’s all automatic, I don’t have to do anything with an offset token or next_page, nothing…fantastic. The pagination page implied otherwise, is it out of date or is it just me misinterpreting it? Build an app with Asana