为什么Github API会让我访问但不会列出私人回购?

时间:2017-02-12 12:20:05

标签: python git api github oauth

我写了一个小脚本,从我的个人或组织回购中下载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'])

...我从公共存储库中获取了所有内容,但没有一个私有存储库可见。

发生了什么,我该如何解决?

1 个答案:

答案 0 :(得分:1)

您是否尝试过GET /user/repos

如此处所述list your repos

看起来GET /users/:username/repos仅列出公开回购:list user public repos

相关问题