python3 获取自建gitlab用户提交信息
#!/usr/bin/env python# -*- coding: utf-8 -*-
# @Time : 2019-12-03 14:20
# @Author : Anthony
# @Email : xxxxx@163.com
# @File : check_gitlab_log.py
# 注意 python-gitlab==1.4.0,该版本及该版本以下都支持v3,该版本以上只支持v4
import requests
import re
import time
url = "http://gitlab.test.cn/api/v3/projects?private_token=xxxxxxx&per_page=500"
response = requests.get(url=url)
#gitlab组名
p_group = ['spring-cloud-java']
data = response.json()
for i in data:
if i['ssh_url_to_repo'].split(':')[1].split('/')[0] in p_group:
# print(i)
time.sleep(0.3)
# 获取每个项目下的信息
r1 = requests.get('http://gitlab.test.cn/api/v3/projects/%d/repository/commits/master?private_token=xxxxxxx&per_page=1000'%i['id'])
data2 = r1.json()
print(i['path'],data2['author_name'],data2['created_at'],data2['message'])
'''
#获取每个项目的信息
http://gitlab.test.cn/api/v3/projects?private_token=xxxxxxx-iB&per_page=100
#获取每个项目下用户信息
http://gitlab.test.cn/api/v3/projects/171/users?private_token=xxxxxxx&per_page=100
'''
以上是 python3 获取自建gitlab用户提交信息 的全部内容, 来源链接: utcz.com/z/388752.html