Open sglebs opened 1 week ago
Pagination: https://developer.freshdesk.com/api/#pagination
Here's my patch:
def list_from_folder(self, id):
page_number = 1
while True:
url = "solutions/folders/%d/articles?page=%d" % (id, page_number)
articles = self._api._get(url)
for a in articles:
yield SolutionArticle(**a)
page_number += 1
if len(articles)== 0:
break
If a category can have more than 30 folders, the same bug will happen there. Here'w what else to patch:
def list_from_category(self, category_id):
page_number = 1
while True:
url = "solutions/categories/%d/folders?page=%d" % (category_id, page_number)
folders = self._api._get(url)
for r in folders:
yield SolutionFolder(**r)
page_number += 1
if len(folders)== 0:
break
If you need the fix, you can (for now) use this:
pip install https://github.com/sglebs/python-freshdesk/archive/pagination.zip
The code below can't fetch all the articles in a folder if it has more than 30.
How can pagination be used?