Commit e682b053 authored by Dimitri Podborski's avatar Dimitri Podborski
Browse files

really simple script to try out the GitLab API

parent e9c96bf2
""" Test GitLab API
To work properly this script requires following:
1. GITLAB_TOKEN environment variable to be set to your private token.
Create your private token here:
2. pip install --upgrade python-gitlab
import os
import sys
import gitlab
TOKEN = os.environ.get('GITLAB_TOKEN')
if not TOKEN:
print("No private token found, please set the GITLAB_TOKEN environment variable")
# private token authentication
gl = gitlab.Gitlab('', private_token=TOKEN)
# get all projects
# projects = gl.projects.list(all=True)
# print(len(projects))
project = gl.projects.get(PROJECT_ID)
# list issues
issues = project.issues.list()
print("List all issues of the project")
for issue in issues:
# get issue
# issue = project.issues.get(iid)
# create new issue
# issue = project.issues.create({'title': 'Created using API', 'description': 'Foobar some text here'})
# update an issue
# issue.labels = ['Bug', 'Info']
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment