Skip to content
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

pagination #1

Closed
sylaroche opened this issue Oct 19, 2021 · 3 comments
Closed

pagination #1

sylaroche opened this issue Oct 19, 2021 · 3 comments
Assignees

Comments

@sylaroche
Copy link

if there is more than 20 results in a GET from a gitlab API you only get the 20 first results ...
you can extend the page up to 100 but after that you have to use the pages to get all results.

@sylaroche
Copy link
Author

# Get available Gitlab users
gl_users = []
page = 1
while True:
    rq = requests.get(f'{GITLAB_API}/users?page=' + str(page), 
    headers={'PRIVATE-TOKEN': GITLAB_TOKEN}, verify=VERIFY_SSL_CERTIFICATE)
 
    gl_users += (rq.json()) 
    
    if (rq.headers["x-page"] != rq.headers["x-total-pages"]):  
        page = rq.headers["x-next-page"] 
    else:
        break

@swingbit
Copy link
Owner

swingbit commented Oct 19, 2021

Hi @sylaroche , thanks for reporting this.

You are right, I didn't really think about this because my intended use case was to migrate to an almost entirely empty Gitlab deployment. In my case I let the script create all users in Gitlab.

I'll fix it asap.

@sylaroche
Copy link
Author

sylaroche commented Oct 23, 2021 via email

swingbit added a commit that referenced this issue Feb 3, 2022
- Implement translation of issue references from Bitbuket commits
- Extend the configurable options
- Many bugfixes
@swingbit swingbit self-assigned this Feb 3, 2022
@swingbit swingbit closed this as completed Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants