From 1a16347e5acf66c0755818de12418ac02b9a0a64 Mon Sep 17 00:00:00 2001 From: Ermanno Baschiera Date: Sat, 2 Mar 2024 22:13:46 +0100 Subject: [PATCH] fix paginated projects retrieving Fixes #1310 --- atlassian/jira.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/atlassian/jira.py b/atlassian/jira.py index d26e68a18..ee76bea58 100644 --- a/atlassian/jira.py +++ b/atlassian/jira.py @@ -2324,13 +2324,18 @@ def projects_from_cloud(self, included_archived=None, expand=None): included_archived=included_archived, expand=expand, ) - while not projects.get("isLast"): - projects["values"].extend( - self.paginated_projects( + is_last_page = projects.get("isLast") + next_page_url = projects.get("nextPage") + while not is_last_page: + next_page_projects = self.paginated_projects( included_archived=included_archived, expand=expand, - url=projects["nextPage"], - )["values"] + url=next_page_url, + ) + next_page_url = next_page_projects.get("nextPage") + is_last_page = next_page_projects.get("isLast") + projects["values"].extend( + next_page_projects["values"] ) return projects["values"]