安装:pip install python-gitlab

import gitlab
# 登录
gl = gitlab.Gitlab('http://127.0.0.1', private_token='JVNSESs8EwWRx5yDxM5q') 
# 列出所有的项目
projects = gl.projects.list()
for project in projects:
    print(project)
# 通过id获取项目
project = gl.projects.get(1)
print(project.name,project.id,project.attributes)
issues = project.issues.list()
print(issues)
# 列出所有的组
all_groups = gl.groups.list(all=True)
for group in all_groups:
    print(group.name,group.id)
#获取某文件的内容:
f = project.files.get(file_path='src/README.rst', ref='master') 
content_base = base64.b64decode(f.content)
content = str(content_base, 'utf-8')
}

 参考:http://python-gitlab.readthedocs.io/en/stable/cli.html 

相关文章:

  • 2021-07-09
  • 2022-02-09
  • 2022-03-02
  • 2021-12-18
  • 2021-07-22
  • 2021-07-29
  • 2021-07-01
猜你喜欢
  • 2021-10-08
  • 2021-06-16
  • 2021-08-14
  • 2022-01-20
  • 2021-05-16
  • 2021-08-26
  • 2021-06-29
相关资源
相似解决方案