-
Notifications
You must be signed in to change notification settings - Fork 668
projects.all() returns only 20 projects #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There's some inconsistency in the listing methods. The managers' all_projects = gl.projects.list(all=True) This is not supported on other listing method ( |
gl.projects.list(all=True) returns 10 projects only. gl.projects.all() returns 20 projects. If you look at the code: projects.all() calls custom_list, which makes a single API request. projects.list call gl.list(), which has some code here but that stops after 10 results because there's no 'next' field in the response. The returned response is:
which does not have 'next' property. How do I iterate to return all projects in the new code base? |
ps: gl.projects.all() receives this API response:
but then fails to process the 'next' field as far as I can see. How is this supposed to work? |
Oh, and I know why. projects.all() issues a request for /projects/all, but then doesn't process the 'next' field in the r.links. projects.list(all=True) issues a request for /projects, in which case the API response doesn't have a 'next' field. |
OK, I think I get what you need. You can still iterate using the l = []; page = 0
while True:
next_list = gl.projects.all(per_page=50, page=page)
if not next_list:
break
l.extend(next_list)
page += 1 I'll implement the Thanks. |
|
Having exactly 20 internal and 5 private projects in the group spent some time debugging this issue. Hopefully that helped: python-gitlab#93 Imho should be definitely mention about `all=True` parameter.
Having exactly 20 internal and 5 private projects in the group spent some time debugging this issue. Hopefully that helped: #93 Imho should be definitely mention about `all=True` parameter.
In issue #53 I had asked how to list all projects. The answer was pagination.
I am now trying the same with the current version of python-gitlab. This time, I am using gl.projects.all() as recommended in the deprecation warning I received with my old code.
However, it seems the code isn't doing any pagination (is it no longer necessary? In Issue #53, you said there's no way to avoid it?
As a result, I'm only getting 20 projects returned.
What's the way to iterate over all projects using python-gitlab?
The text was updated successfully, but these errors were encountered: