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

group.members.get only working if result is within first 20 #499

Closed
ericfrederich opened this issue May 17, 2018 · 0 comments
Closed

group.members.get only working if result is within first 20 #499

ericfrederich opened this issue May 17, 2018 · 0 comments

Comments

@ericfrederich
Copy link
Contributor

Description of the problem, including code/CLI snippet

group.members.get(userid) only seems to be working if that userid is within first 20 hits.
Run this on any group with more than 20 members:

group = gl.groups.get('some-group')
# iterate over the exhaustive list of members as a generator
for member in group.members.list(as_list=False):
    # so this call should never fail; but it does
    group.members.get(member.id)

Expected Behavior

Ultimately it should call https://docs.gitlab.com/ce/api/members.html#get-a-member-of-a-group-or-project with the exact group id and user id. This would be most efficient.

Alternatively it could call .list() in such a way that it is able to iterate over all results. For example .list(as_list=False) to force a generator to be returned or .list(all=True) to force the exhaustive list to be returned. But again, this is bad if there is a more efficient API to call as linked to above.

Actual Behavior

It ends up calling GetFromListMixin which ends up calling http_list with no arguments which just returns 20 items. It then compares those id's to the requested one.

Specifications

  • python-gitlab version: 1.3.0
  • API version you are using (v3/v4): 4
ericfrederich added a commit to ericfrederich/python-gitlab that referenced this issue May 17, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 9, 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

1 participant