How to get groups and projects for current user ?
I'm not sure if I am doing something wrong, but I try to get my groups and projects on gitlab.com and I see quite a difference:
Mostly taken from the Getting started > Managers docs:
from gitlab import Gitlab
gitlab_token = '<snipped>'
gitlab = Gitlab(private_token=gitlab_token)
# this gets me (an iterator over) all MY groups
groups = gitlab.groups.list(iterator=True)
# this gets me (an iterator over) ALL (public ?) projects on gitlab.com
projects = gitlab.projects.list(iterator=True)
Looking at #404 (comment), it seems I need to get projects via some user object, will try that out next. Still wondering...
Is this the intended behavior ?
Why the difference ?
Expected Behavior
I would expect groups.list(...) and projects.list(...) to use the same approach (least surprise principle) and either both return my resources or all public resources, but not do something for the first and something else for the second resource.
Actual Behavior
groups.list(...) returns (an iterator over) my groups (i.e. the groups belonging to the currently authenticated GitLab user.
projects.list(...) returns (an iterator over) all projects (presumably the public ones) on the GitLab instance.
Specifications
- python-gitlab version:
3.6.0
- API version you are using (v3/v4):
v4
- Gitlab server version (or gitlab.com):
gitlab.com
How to get groups and projects for current user ?
I'm not sure if I am doing something wrong, but I try to get my groups and projects on gitlab.com and I see quite a difference:
Mostly taken from the Getting started > Managers docs:
Looking at #404 (comment), it seems I need to get projects via some user object, will try that out next. Still wondering...
Is this the intended behavior ?
Why the difference ?
Expected Behavior
I would expect
groups.list(...)andprojects.list(...)to use the same approach (least surprise principle) and either both return my resources or all public resources, but not do something for the first and something else for the second resource.Actual Behavior
groups.list(...)returns (an iterator over) my groups (i.e. the groups belonging to the currently authenticated GitLab user.projects.list(...)returns (an iterator over) all projects (presumably the public ones) on the GitLab instance.Specifications
3.6.0v4gitlab.com