install_python_gitlab.sh
pip install python-gitlabget_gitlab_group_id.py
import gitlab
def get_gitlab_group_id(group_name, access_token):
# Initialise une instance GitLab avec votre jeton privé
gl = gitlab.Gitlab('https://gitlab.com', private_token=access_token)
# Recherche des groupes par nom
groups = gl.groups.list(search=group_name)
for group in groups:
if group.name == group_name or group.path == group_name:
return group.id
raise ValueError("Groupe non trouvé")
# Exemple d'utilisation
group_id = get_gitlab_group_id("Protectors of the Footprint Realm", 'glpat-yykIsrTg6RyKcFAvd2os')group_id sera un entier, par exemple 6604163
Si cet article vous a aidé, pensez à m'offrir un café ou à faire un don via PayPal pour soutenir la recherche et la publication de nouveaux articles sur TechOverflow