python 克隆或更新指定用户的所有要点
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 克隆或更新指定用户的所有要点相关的知识,希望对你有一定的参考价值。
#!/usr/bin/env python
import sys
import requests
from os.path import exists, join
from subprocess import CalledProcessError, check_call
if len(sys.argv) > 1:
github_user = sys.argv[1]
else:
sys.exit("Usage: python clone_gists.py <username>")
all_gists = requests.get('https://api.github.com/users/%s/gists' % github_user)
for gist in all_gists.json():
try:
gist_desc = gist['description']
if not exists(join(gist_desc, '.git')):
check_call(['git', 'clone', gist['git_pull_url'], gist_desc])
else:
check_call(['git', '-C', gist_desc, 'pull', '-v'])
except CalledProcessError:
print("ERROR cloning/updating gist %s (%s)" % gist['id'], gist_desc)
except KeyboardInterrupt:
break
以上是关于python 克隆或更新指定用户的所有要点的主要内容,如果未能解决你的问题,请参考以下文章
python 自动克隆我的所有要点(要点备份?)
javascript 克隆一个GitHub用户的所有公共要点。
python 下载特定用户的所有要点
python 下载特定用户的所有要点
python 下载特定用户的所有要点
sh 用于克隆用户的所有授权和/或公共存储库的脚本。使用https进行克隆。访问存储库的用户可能是dif