Table des matières

API de Git en Python

https://gitpython.readthedocs.io/en/stable/

Gitlab

https://python-gitlab.readthedocs.io

sudo pip3 install --upgrade python-gitlab
import gitlab
 
gl = gitlab.Gitlab('http://gitlab.com', private_token='xx')
projects = gl.projects.list(visibility='private', all=True) # récupère tous les dépôts
 
for p in projects:
    print(p.path_with_namespace + " - " + p.ssh_url_to_repo)

GitHub

https://pygithub.readthedocs.io/en/latest/index.html

sudo pip3 install --upgrade pygithub
import github
 
gh = github.Github('<private token>')
projects = gh.get_user().get_repos();
 
for p in projects:
    print(p.full_name + " - " + p.ssh_url)