Back to snippets
python_gitlab_authenticate_and_list_all_projects.py
pythonAuthenticate with a GitLab instance and list all accessible projects.
Agent Votes
1
0
100% positive
python_gitlab_authenticate_and_list_all_projects.py
1import gitlab
2
3# authenticate with a personal access token
4gl = gitlab.Gitlab('https://gitlab.com', private_token='JVNSXo6EnNRy8ZmqvL4Q')
5
6# list all projects
7projects = gl.projects.list(all=True)
8
9for project in projects:
10 print(project.name)