Questions tagged [python-gitlab]

The python-gitlab library is a Python library that provides bindings for interacting with GitLab, an open-source git repository manager that features multiple features such as issue tracking, wikis, and continuous integration features.

python-gitlab is a Python library that provides bindings for the GitLab API v4 for interacting with GitLab, an open-source git repository manager that features multiple features such as issue tracking, wikis, and continuous integration features.

See the python-gitlab repo on Github.

See read-the-docs

68 questions
0
votes
0 answers

python-gitlab read a file in the description of an issue

I have an issue in gitlab where I have uploaded xlsx files into the description of an issue in gitlab. I am trying to download these files from a juypter notebook and cannot. How do I read the list of files I have below? import gitlab gl =…
0
votes
1 answer

How do I list the tags for a runner using python-gitlab

I know how to get to (some) attributes of runners setup for a gitlab project. I need though to list the tags each runner defines? Below is as far as I have gone. gl = gitlab.Gitlab(url=, private_token=) project =…
minice
  • 61
  • 8
0
votes
0 answers

Python-Gitlab - How to reset iterator on RestobjectList

I am iterating over a branch list multiple times and it seems that the pointer needs to be reset. Python-gitlab v3.12.0 e.g. branchlist = self.project.branches.list(iterator=True) m_branchlist = [i for i in branchlist if (i.merged==True)] …
Genhob
  • 13
  • 3
0
votes
1 answer

Python Gitlab API - attributes

Using python Gitlab API, how to list merge requests filtered by some attributes ? For instance, using curl I can use attributes in my request like ?author_username=MY_NAME&source_branch=MY_BRANCH. But I cannot find those attribute in the…
flod
  • 235
  • 4
  • 12
0
votes
0 answers

Python-Gitlab: Wait until deleting a branch is completed

I'm having an issue with Gitlab when deleting branches in Python. The problem is that Gitlab seems to be taking too long to complete the deletion, and I'm not sure why. I've created a brute-force code to try to reproduce the issue, it sometimes gets…
0
votes
0 answers

Python-GitLab: error connecting to GitLab instance

I'm using a CentOS7 virtual machine created in Oracle VirtualBox. I've installed on it python with sudo yum install python3and then python-gitlab using sudo yum install python-gitlab I've tried this python code import gitlab import os gl =…
Cesare
  • 1,629
  • 9
  • 30
  • 72
0
votes
0 answers

python-gitlab raise 500 when getting file 500 mb

I have ` def get_file(git_path, system_path, branch, project_id): project = gl.projects.get(id=project_id) with open(system_path, "wb") as save_file: project.files.raw(file_path=git_path, ref=branch, streamed=True,…
Alex031
  • 11
  • 1
0
votes
1 answer

How to retrieve the star counts in GitLab Python API?

I try to request the number of stars and commits of a public software repository in GitLab using its Python client. However, I keep getting GitlabHttpError 503 if executing the following script. import gitlab import requests url =…
Jimmy Zhao
  • 303
  • 2
  • 17
0
votes
1 answer

Add a file in Gitlab project repository by Python

I have a python script where I have created an output file as an excel table. Now I would like to add/upload this file to my Gitlab project repository directly by using python-gitlab library. I have found some solution where file was added local…
OliAK
  • 73
  • 8
0
votes
1 answer

KeyError: 'releases' when trying to follow the python gitlab API examples

I'm attempting to following the API example here, but it fails because apparently there is no ProjectReleaseManager on my project. >>> gl.api_version '4' >>> gl_project = gl.projects.get("atlas/athena") >>> gl_project.issues.list() [] >>> release =…
0
votes
1 answer

How to get all users in a project in gitlab through API?

I want to retrieve all members in a project irrespective of their role. According to this documentation (https://docs.gitlab.com/ee/api/members.html) If i use this API : GET /projects/:id/members I can only get the members that are created by the…
0
votes
1 answer

Dynamically setting git config in python

In my python program, I am trying to dynamically set user credentials - GIT config for GIT. Repo.config_writer().set_value("user", "name", "username").release() Repo.config_writer().set_value("user", "email", "email@domain.com").release() It is…
0
votes
2 answers

Python Gitlab API find creator of a project

import gitlab gl = gitlab.Gitlab('http://gitlab.mycompany', private_token=access_token) gl.auth() projects = gl.projects.list() pres = projects[0] for project in projects: if 'myprojectname' in str(project): print(project) pres =…
Huy Le
  • 1,439
  • 4
  • 19
0
votes
1 answer

How can I find out who pushed an image to the Gitlab Container registry

I want to find out who / what user pushed an image to the Gitlab Container registry. Optimally by using the gitlab-python package. When using the gitlab-python package I was able to get the object 'ProjectRegistryRepository'. However, this does not…
Moritz
  • 307
  • 1
  • 4
  • 10
0
votes
1 answer

Get status codes with python-gitlab

Hi does anyone know if there is a way to get http status codes with python-gitlab? Or is there a way to use requests with python-gitlab to get the status codes? Like how in the requests library you you can do r.status_code and that will return 200…
AllUser
  • 13
  • 1
  • 3