[英]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.