根据这个教程想备份 gist , 安装好环境后, 执行代码 提示 找不到文件或文件夹 , 新建了个.gist 文件夹 又提示是 IsADirectoryError: [Errno 21] Is a directory: '/root/.gist'
https://jpmens.net/2019/04/03/backup-all-my-gists/
请问这脚本里如何传入 GitHub api 参数 求指点 谢谢
脚本如下 :
#!/usr/bin/env python -B
from github import Github # pip install PyGithub
import json
import os
all = []
g = Github(open(os.path.expanduser("~/.gist")).read())
for gist in g.get_user().get_gists():
all.append({
"id" : gist.id,
"description" : gist.description,
"public" : gist.public,
"clone" : gist.git_pull_url,
"updated" : gist.updated_at.isoformat(),
"url" : gist.url,
})
# yuck
os.system("git clone '{0}' repos/{1}".format(gist.git_pull_url, gist.id))
with open("index.json", "w") as f:
f.write(json.dumps(all, indent=4) + "\n")
https://jpmens.net/2019/04/03/backup-all-my-gists/
请问这脚本里如何传入 GitHub api 参数 求指点 谢谢
脚本如下 :
#!/usr/bin/env python -B
from github import Github # pip install PyGithub
import json
import os
all = []
g = Github(open(os.path.expanduser("~/.gist")).read())
for gist in g.get_user().get_gists():
all.append({
"id" : gist.id,
"description" : gist.description,
"public" : gist.public,
"clone" : gist.git_pull_url,
"updated" : gist.updated_at.isoformat(),
"url" : gist.url,
})
# yuck
os.system("git clone '{0}' repos/{1}".format(gist.git_pull_url, gist.id))
with open("index.json", "w") as f:
f.write(json.dumps(all, indent=4) + "\n")