Python 查询 GitLab commit 次数

年底了,看看自己这一年总共提交了多少次代码吧。

一、安装 python-gitlab

# Python2
pip install python-gitlab

# Python3
pip3 install python-gitlab

二、下载脚本

我已经写好了脚本,点击这里获取脚本和配置文件

脚本和配置文件
  • config.py 配置文件,需要获取自己的配置信息并填写到该文件中。
  • queryer.py 查询脚本,修改配置后运行该 脚本即可启动查询。

三、获取 GitLab 地址和 Access Token

GitLab 地址

GitLab 地址即安装 GitLab 的服务器地址,如:https://gitlab.***.com

GitLab 地址

Access Token

登录 GitLab 账号, 访问 https://gitlab.***.com/profile/personal_access_tokens 页面。

在该页面填写 Name 并勾选 api ,最后点击 Create personal access token 按钮即可生成 Token

Access Token

保存生成的 Token,否则刷新页面之后就再也看不到它了。

四、查询自己参与的项目

登录 GitLab 账号,访问 https://gitlab.***.com/users/[userName]/contributed 页面即可查看自己参与的项目列表。

[userName] 需要改完自己的用户名

参与的项目

五、运行

# Python2
python your_path/queryer.py

# Python3
python3 your_path/queryer.py

你可能感兴趣的:(Python 查询 GitLab commit 次数)