Skip to content

Make sure to get all items on Gitlab list() calls

Tim Jaacks requested to merge get-all-items-in-gitlab-list-calls into master

The list() call on Gitlab classes uses pagination per default. If the number of items exceeds a certain limit, we only get a part of the results. We can pass "all=True" to the calls in order to disable pagination and get all results. If we're looping over the items, though, the recommended way of getting them is to use a generator object, which works calling list() with "as_list=False". See documentation for reference:

https://python-gitlab.readthedocs.io/en/v2.10.1/api-usage.html#pagination

Note: the "as_list" argument is deprecated in newer versions of the python-gitlab library, in favor of the newer "iterator=True": https://python-gitlab.readthedocs.io/en/v3.6.0/changelog.html#feature We are using v2.10.1 of the library, though, so this commit also updates calls using the new way, which is not working with our version.

Merge request reports