Skip to content

Instantly share code, notes, and snippets.

@epcim
Created May 31, 2019 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save epcim/b6ba947be23bdf78c50d078378677bd9 to your computer and use it in GitHub Desktop.
Save epcim/b6ba947be23bdf78c50d078378677bd9 to your computer and use it in GitHub Desktop.
gitlab python
#!/bin/env python3
import gitlab
import sys
# private token or personal token authentication
gl = gitlab.Gitlab('https://gitlab.com/', private_token='******')
if len(sys.argv) > 1:
if sys.argv[1].find("/") > 0:
project=sys.argv[1]
else:
project="volterra/ves.io/"+sys.argv[1]
gl.auth()
project = gl.projects.get(project)
print(project.id)
else:
print("Usage: %s [yourorg/]projectName" % sys.argv[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment