Skip to content

Support for pagination? #53

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

Closed
godmar opened this issue Feb 5, 2015 · 3 comments
Closed

Support for pagination? #53

godmar opened this issue Feb 5, 2015 · 3 comments

Comments

@godmar
Copy link

godmar commented Feb 5, 2015

all_projects() returns only the first page of results.

The GitLab API documentation says to use the next/pref links in there, and that at most 100 results are returned per page.

Is pagination to obtain all results supported - otherwise, methods like 'all_projects' would be useless.

@gpocentek
Copy link
Contributor

Pagination is supported. you can use the --per-page and --page options:

./gitlab project list --per-page 2 --page 10

@godmar
Copy link
Author

godmar commented Feb 7, 2015

No, that's not what I mean. I meant that a function 'all_projects' should list all projects (from page 1 to page n). Right now, the only way I've found to list all projects is:

for page in count(1):
    projects = gl.all_projects(page=page)
    if len(projects) == 0:
        break
    <process page here>

Is this the only way?

@gpocentek
Copy link
Contributor

Sorry, I misunderstood your question.

AFAIK the gitlab API doesn't provide a method to list all the projects without pagination, so a loop is probably the only way to get what you want.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants