【发布时间】:2017-06-30 11:00:03
【问题描述】:
我编写了一个小脚本,可以从我的个人或组织存储库下载 GitHub 存储库上的所有问题。 完整代码在 github [这里](https://github.com/joereddington/Vision/blob/master/downloadissues.py)
我使用个人访问令牌进行身份验证。
当我像这样直接访问一个私有存储库(我有一个叫做 whitewaterwriters)时:
issues = []
issues.extend(get_json_from_url('https://api.github.com/repos/equalitytime/whitewaterwriters' + '/issues?state=all&filter=all'))
issues = sorted(issues, key=lambda k: k['title'])
for issue in issues:
print issue['title']
download_comment_to_file(issue['title'], issue['comments_url'])
它会愉快地打印出私人仓库中的所有问题。
但是,当我使用更通用的代码时:
repos = []
repos = get_json_from_url(MY_REPO_ROOT+'/repos')
repos.extend(get_json_from_url(EQT_REPO_ROOT+'/repos'))
issues = []
for repo in repos:
if repo['has_issues']:
issues.extend(get_json_from_url(repo['url'] + '/issues?state=all&filter=all'))
issues = sorted(issues, key=lambda k: k['title'])
for issue in issues:
print issue['title']
download_comment_to_file(issue['title'], issue['comments_url'])
...我从公共存储库中获取所有内容,但没有一个私有存储库可见。
发生了什么,我该如何解决?
【问题讨论】:
-
MY_REPO_ROOT+'/repos'是一个有效的网址吗?你在reposvar 得到什么? -
Repos var 为我提供格式良好的输出,其中包含 public repos 的所有信息。我已经编辑了我的问题以使其更清晰...
-
你问过github支持吗?
标签: python git api github oauth