Skip to main content

GitLab API Python Wrapper

Project description

GitLab API

Version: 0.5.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


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.5.0-py2.py3-none-any.whl (14.9 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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