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
7
votes
2 answers

Gitlab Api Commits Behind/Ahead Master

On the Gitlab webpage you have the possibility to check how many commits a branch is behind or ahead of the master branch. My question is if it is possible to get information about this with the "gitlab API"? I checked the docs but unfortunately…
Tessaiga
  • 71
  • 1
2
votes
1 answer

Gitlab v4 api 403 forbidden error for project.variables.list(get_all=True)

I am using Gitlab v4 api to list a project's variables, while the code returns vars for some projects, it also returns 403 forbidden response for some other projects. And the error is not very verbose so I'm confused what could be the possible…
blackPanther
  • 181
  • 1
  • 3
  • 14
2
votes
1 answer

Unable to connect to python-gitlab

I am attempting to use python-gitlab to create a script that automates the creation of branches. However, when I try to connect and get a specific group, I get the error: Exception has occurred: SSLError HTTPSConnectionPool(host='gitlab.X.com',…
2
votes
1 answer

How to get GitLab commits of a file using python gitlab module?

We are trying to get the commits of each file in a Gitlab repository. We are using the Python Gitlab module. We could get the commits of a repository but couldn't get the commits of individual files in the repository. Can someone help us with this?
Shiny S U
  • 43
  • 2
  • 5
2
votes
1 answer

Upload binary files using python-gitlab API

I'm tasked with migrating repos to gitlab and I decided to automate the process using python-gitlab. Everything works fine except for binary or considered-binary files like compiled object files ( .o ) or .zip files. (I know that repositories are…
Rad226
  • 97
  • 8
2
votes
1 answer

How can I read the projects list from a GitLab group with GitPython?

I am trying to find a way to clone all the git repositories from a remote GitLab group with Python (gitPython for example). Can you help me, please?
mo45
  • 21
  • 2
2
votes
1 answer

Is there an efficient way of finding failed pipelines on gitlab?

I would like to get a list of all projects in a group, where the last pipeline has not succeeded. My current code: def failed_pipelines(groupid): g = gitlab.Gitlab('https://gitlab.com', private_token=GITLAB_API_TOKEN) group =…
thebjorn
  • 26,297
  • 11
  • 96
  • 138
1
vote
1 answer

Trouble mocking the return value of python-gitlab method

I am trying to mock the return value of the following method import gitlab from unittest.mock import patch def get_all_iters(): gl = gitlab.Gitlab(url='test_url', private_token) result = gl.groups.get(1).iterations.list() # trying to mock the…
Songg Tùng
  • 139
  • 8
1
vote
0 answers

How to check if a file is stored via LFS without downloading its content using python-gitlab?

I have several files stored on my repository. Some are stored via LFS. I want to check that the file I am handling is stored via LFS without downloading it using python-gitlab. Is it possible to do so? For now, to check if a file is stored via LFS,…
vvvvv
  • 25,404
  • 19
  • 49
  • 81
1
vote
0 answers

Using Python Gitlab API to search for all public repositories

I want to identify all public repositories in Gitlab with a specific condition. For example, I want to identify all Java projects that has "AndoridManifest.xml" file and contains the word "app" in the repository title or the readme file. I could do…
Safwat
  • 11
  • 2
1
vote
0 answers

How do I retrieve and save an avatar from a gitlab project using python?

So I'm creating projects and deleting them by python script using the gitlab python API. That part is working. But a colleague started adding some avatars to some of my autoprojects that I found amusing and wanted to save them and restore them. But…
J. Hein
  • 21
  • 3
1
vote
1 answer

Python Gitlab commit functionality works from main but the same thing doesn't work when put into a function

I have been trying to make a git commit using gitlab python module and this code works fine when executed from main - private_token = "xxxxxx" gl = gitlab.Gitlab('https://gitlab.xyz.net/', private_token) project_id = 10000 my_project =…
Sn_Srm
  • 101
  • 1
  • 8
1
vote
1 answer

Gitlab-Python Api. After creating MR cant get actual MR status info

Im creating MR with python-gitlab. After creation i need to check for mr_conflicts and pipeline state. project = gl.projects.get(PROJECT_ID, lazy=False) create_mr = project.mergerequests.create({'id': PROJECT_ID, …
Dim
  • 13
  • 4
1
vote
1 answer

Python-GitLab Unprotect master

In the previous version of Python-GitLab after creating the project and adding a user as a developer, we have been using: # Unprotect master branch = project.branches.get('master') branch.unprotect() as we wish to allow developer access to the…
BlackWoxs
  • 13
  • 3
1
vote
1 answer

python-gitlab mocking ProjectCommit objects API V4

I am trying to create a mock object of gitlab.v4.objects.ProjectCommit to perform integration tests between a tool I am developing with python-gitlab api. In order to create a ProjectCommit mock object by mocking the RESTManager object using…
farch
  • 315
  • 4
  • 14
1
2 3 4 5