gitlab-api

Python unittest – assert called with is not working

Python unittest – assert called with is not working Question: i do a gitlab api call to a put_request and for my test I want to mock this call and assert if this call was called with the specific input. The problem is I do two put requests in my question with different input. This …

Total answers: 1

Upload secure files to GitLab using requests python module

Upload secure files to GitLab using requests python module Question: I’m trying to upload a secure file to my repository in GitLab. While I am able to upload a secure file with curl, I encounter an error when using requests in Python. my python code: r = requests.post("https://gitlab.com/api/v4/projects/10186699/secure_files", headers={"PRIVATE-TOKEN": "glpat-TH7FM3nThKmHgOp"}, files={"file": open("/Users/me/Desktop/dev/web-server/utils/a.txt", "r"), "name": "a.txt"}) …

Total answers: 1

How can I extract specific value from JSON response?

How can I extract specific value from JSON response? Question: Hi I am trying to get value from JSON response which Im getting from GitLab API. Code should extract "commiter_name" value but it does not work, already tried several options from internet. def getCom(): com = requests.get("https://gitlab.com/api/v4/projects/.." headers = {‘PRIVATE-TOKEN’: ‘…..’}).content Error: File "getData.py", line …

Total answers: 1

Unable to connect to python-gitlab

Unable to connect to python-gitlab Question: 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’, port=443): Max retries exceeded with url: /api/v4/groups/17996 (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate …

Total answers: 1

How can I extract contents from a file stored in gitlab repos

How can I extract contents from a file stored in gitlab repos Question: Using the gitlab-python package, I’d like to extract lines from all Dockerfiles. Using my code below, I am able to get project names and url to the repo I want but how can I ensure there is a Dockerfile and read the …

Total answers: 1

GitLab CE API: Check if used token has admin rights

GitLab CE API: Check if used token has admin rights Question: I am working on a Python module for the GitLab API. Is there any possibility to check if the user with the private token in use has admin rights on the GitLab server? One way would be to get something from the API, e.g. …

Total answers: 3