GitLab API Python Wrapper
Project description
GitLab API
Version: 0.15.41
Pythonic GitLab API Library
Includes a large portion of useful API calls to GitLab and SQLAlchemy Models to handle loading API calls directly to a database!
This repository is actively maintained - Contributions are welcome!
API Calls:
- Branches
- Commits
- Deploy Tokens
- Groups
- Jobs
- Members
- Merge Request
- Merge Request Rules
- Packages
- Pipeline
- Projects
- Protected Branches
- Releases
- 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(f"Merge Request Title: {created_merge_request.data.title}\nDescription: {created_merge_request.data.description}")
users = client.get_users()
print(f"First user's email: {users.data[0].email}")
print(f"Projects: {client.get_projects()}")
response = client.get_runners(runner_type='instance_type', all_runners=True)
print(f"Runners: {response}")
#!/usr/bin/python
# coding: utf-8
import gitlab_api
from gitlab_api import Branch
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(f"Merge Request Title: {created_merge_request.data.title}\nDescription: {created_merge_request.data.description}")
users = client.get_users()
print(f"First user's email: {users.data[0].email}")
print(f"Projects: {client.get_projects()}")
response = client.get_runners(runner_type='instance_type', all_runners=True)
print(f"Runners: {response}")
Installation Instructions:
Install Python Package
python -m pip install gitlab-api
Tests:
pre-commit check
pre-commit run --all-files
pytest
python -m pip install -r test-requirements.txt
pytest ./test/test_gitlab_models.py
Repository Owners:
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
Close
Hashes for gitlab_api-0.15.41-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b878d99e2f43fa8aaaffb604d0c388da3fe2593d9f483b627f2b69d78ad4591 |
|
MD5 | 46b30921677a803b6f17201366ce3f92 |
|
BLAKE2b-256 | bed7081d1dd7b034e6a04760af8b7c279b7819962274381f92db0d6266cc2300 |