Skip to main content

GitLab API Python Wrapper

Project description

GitLab API

Version: 0.4.0

GitLab API Python Wrapper

Includes a large variety of API calls to GitLab

This repository is actively maintained and will continue adding more API calls

API Calls:

  • Branches
  • Commits
  • Deploy Tokens
  • Groups
  • Jobs
  • Members
  • Merge Request
  • Merge Rules
  • Packages
  • Pipeline
  • Projects
  • Protected Branches
  • Runners
  • Users
  • Wiki

Usage:

#!/usr/bin/python
# coding: utf-8
import gitlab_api

token = "<GITLAB_TOKEN/PERSONAL_TOKEN>"
gitlab_url = "<GITLAB_URL>"
client = gitlab_api.Api(url=gitlab_url, token=token)

users = client.get_users()
print(users)

created_merge_request = client.create_merge_request(project_id=123, source_branch="development", 
                                                    target_branch="production",title="Merge Request Title")
print(created_merge_request)

print(f"Users: {client.get_users()}")

print(f"Projects: {client.get_projects()}")

response = client.get_runners(runner_type='instance_type', all_runners=True)
print(f"Runners: {response}")

Install Instructions

Install Python Package

python -m pip install gitlab-api

Build Instructions

Build Python Package

sudo chmod +x ./*.py
pip install .
python setup.py bdist_wheel --universal
# Test Pypi
twine upload --repository-url https://test.pypi.org/legacy/ dist/* --verbose -u "Username" -p "Password"
# Prod Pypi
twine upload dist/* --verbose -u "Username" -p "Password"

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

gitlab_api-0.4.0-py2.py3-none-any.whl (14.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file gitlab_api-0.4.0-py2.py3-none-any.whl.

File metadata

  • Download URL: gitlab_api-0.4.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for gitlab_api-0.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c5fba862d7407492fb15d5825319ffddc17a19d99624445d605d8413a446f280
MD5 c97002f7868ab48c14c75676edaf1f0d
BLAKE2b-256 e06ffbe8df31540722b77a4871aa92077d5ecbbabe1aa6077d9db0d4f3826091

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page