一段导出gitlab工程的python脚本 发表于 2018-07-19 | 更新于: 2018-07-19 | 分类于 Python | | 阅读次数: | 字数统计: 134 | 阅读时长 ≈ 1 安装python-gitlab1pip install python-gitlab 1234567891011121314151617181920212223242526272829303132#!/usr/bin/python# -*- coding: UTF-8 -*-import gitlabdef auth(): gl = gitlab.Gitlab('http://192.168.1.105', private_token='dfshgjkdfgcxvhjkdshfa') gl.auth() return gldef project_list(): gl = auth() projects = gl.projects.list(all=True) if(projects != None): for project in projects: download_project(gl, project)def download_project(gl, p): export = p.exports.create({}) # Wait for the 'finished' status export.refresh() while export.export_status != 'finished': time.sleep(1) export.refresh() # Download the result with open('C://', 'wb') as f: export.download(streamed=True, action=f.write)project_list() 注意:GitLab版本至少10.6 本文作者: 南风 本文链接: http://www.jackfan.top/posts/2883/ 版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议。转载请注明出处!