简体   繁体   English

为什么Github API可以让我访问但不列出私有存储库?

[英]Why will Github API let me access but NOT list private repos?

I have written a small script to download all issues on GitHub repos from either my personal or organizational repos. 我编写了一个小脚本,从我的个人或组织存储库下载GitHub存储库上的所有问题。 The full code is itself on github [here] ( https://github.com/joereddington/Vision/blob/master/downloadissues.py ) 完整的代码本身在github [here]https://github.com/joereddington/Vision/blob/master/downloadissues.py )上

I use a personal access token for authentication. 我使用个人访问令牌进行身份验证。

When I access a private repository (I have one called whitewaterwriters) directly like this: 当我直接访问私有存储库(我有一个叫做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'])

It happily prints out all issues from the private repo. 它愉快地打印出私人仓库中的所有问题。

However, when I use more general code: 但是,当我使用更通用的代码时:

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'])

...I get all of the content from my public repositories, but none of the private repositories are visible. ...我从公共存储库中获取了所有内容,但没有一个私有存储库可见。

What's going on and how do I fix it? 怎么回事,我该如何解决?

Have you tried just GET /user/repos ? 您是否尝试过GET /user/repos

as mentioned here list your repos 如此处所述, 列出您的存储库

Looks like GET /users/:username/repos is to list only public repos : list user public repos 看起来GET /users/:username/repos仅列出公共存储库: 列出用户公共存储库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Github:您可以访问用户使用个人令牌与您共享的私有存储库列表吗? - Github: Can you access the list of private repos that a user has shared with you using the personal token? pyinstaller更新程序与github / bitbucket私人回购 - pyinstaller updater with github / bitbucket private repos 私有GitHub的回购+ SSH + pip =令人头疼 - Private GitHub's repos + SSH + pip = headache 如何将我的 github 组织名和访问令牌放在这一行“requests.get(url='https://api.github.com/users/' + orgname + '/repos?page={}'.format(page) )" - how to put my github orgname & access token in this line "requests.get(url='https://api.github.com/users/' + orgname + '/repos?page={}'.format(page))" github API-根据日期获取组织的所有回购的所有提交 - github api - fetch all commits of all repos of an organisation based on date Tweepy 不允许我使用用户列表运行 api.get_user,也不允许在一个人上运行 - Tweepy does not let me run api.get_user with a list of users and also not on a single person IndexError : list index out of range 请让我知道为什么我的代码不起作用 - IndexError : list index out of range Please let me know why isnt my code working 带有所有详细信息的github仓库 - github repos with all details 浏览 Github 存储库 - Navigating through Github repos 为什么Python不让我打开Terminal? - Why will Python not let me open up Terminal?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM