NoDataDumpNoContribution
NoDataDumpNoContribution

Reputation: 10869

How to get all starred projects by a user from the Gitlab API

I want to get a list of all projects that a certain user on Gitlab has starred using the Gitlab API and Python (via python-gitlab).

The documentation from python-gitlab on users does not mention starred projects. It may be a user activity, but the documentation on user activities just refers to user activity managers and about that no further documentation is available.

With the Github API and pyGithub it's possible to achieve that using

import github
g = github.Github()
u = g.get_user()
u.get_starred()

However, with the Gitlab APi and python-gitlab I only get as far as:

import gitlab
gl = gitlab.Gitlab()
u = gl.users.get()
u.get_starred()  # AttributeError
u.starred()  # AttributeError

I think it might be possible because on a Gitlab website I can see the starred projects of a user. Example: https://gitlab.com/users/username/starred

Upvotes: 1

Views: 1036

Answers (1)

Eshwar S R
Eshwar S R

Reputation: 136

I'm not sure if gitlab python package has it. But there is a REST API for the same. Refer this link https://docs.gitlab.com/ee/api/projects.html#list-projects-starred-by-a-user

You can use requests module to do the GET and POST requests using python.

Upvotes: 1

Related Questions