From 36cd12411de6b460f983ba54311bb52ba1e33710 Mon Sep 17 00:00:00 2001 From: Florian Lauck Date: Tue, 7 Nov 2023 18:12:17 +0100 Subject: [PATCH] Force python-gitlab to retrieve all objects instead of the first 20 python-gitlab limits the number of retrieved entities (groups/subgroups) to 20, see: https://python-gitlab.readthedocs.io/en/v4.1.1/api-usage.html#pagination This change forces python-gitlab to retrieve all entities. --- gitlabber/gitlab_tree.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gitlabber/gitlab_tree.py b/gitlabber/gitlab_tree.py index bff3b44..c998083 100644 --- a/gitlabber/gitlab_tree.py +++ b/gitlabber/gitlab_tree.py @@ -115,7 +115,7 @@ def add_projects(self, parent, projects): def get_projects(self, group, parent): try: - projects = group.projects.list(iterator=True, archived=self.archived) + projects = group.projects.list(iterator=True, archived=self.archived, get_all=True) self.progress.update_progress_length(len(projects)) self.add_projects(parent, projects) except GitlabListError as error: @@ -147,7 +147,7 @@ def add_groups(self, parent, groups): def get_subgroups(self, group, parent): try: - subgroups = group.subgroups.list(iterator=True, archived=self.archived) + subgroups = group.subgroups.list(iterator=True, archived=self.archived, get_all=True) except GitlabListError as error: log.error(f"Error listing group {group.name} (ID: {group.id}): {error}. Check your permissions as you may not have access to it.") return @@ -173,7 +173,8 @@ def load_gitlab_tree(self): if not groups: groups = self.gitlab.groups.list(iterator=True, archived=self.archived, - top_level_only=True) + top_level_only=True, + get_all=True) self.progress.init_progress(len(groups)) for group in groups: if group.parent_id is None: