访问:https://git.fpi-inc.site/api/v4/groups,查看你能查看的项目。
找到你需要下载项目的ID

建立py文件gitlab,并且配置你的private_token

import json import shlex import subprocess from urllib.request import urlopen import re if __name__ == '__main__': allProjects = urlopen("https://git.fpi-inc.site/api/v4/groups/168?private_token=******") allProjectsDict = json.loads(allProjects.read().decode()) urls = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+.git', str(allProjectsDict)) for thisProject in urls: # print(thisProject) thisProjectURL = thisProject # print(thisProjectURL) try: command = shlex.split('git clone %s' % thisProjectURL) resultCode = subprocess.Popen(command) except Exception as e: command = shlex.split('git fetch %s' % thisProjectURL) resultCode = subprocess.Popen(command) print("Error on %s: %s" % (thisProjectURL, e.strerror))
执行命令

网友评论