来自github中的私人组织的所有存储库的列表 - python

这是我需要的:

我想检索我的私有组织中所有回购的列表,获取所有回购的团队列表,然后从每个团队中获取所有成员。

我现在尝试在python中使用简单的身份验证请求(通过http命令传递)来做到这一点,但这并没有给我完整的回购清单。

有人做过吗?我可以尝试使用示例的任何python模块吗?

python大神给出的解决方案

因此,您可以使用github3.py(pip install github3.py)很好地做到这一点:

import github3

gh = github3.login("Jason", "Jason's password")
org = gh.organization("Jason's organization with private repos")
repos = list(org.iter_repos(type="all"))  # Or type="private"

另外,如果您喜欢冒险(pip install --pre github3.py预览github3.py的1.0.0):

import github3

gh = github3.login("Jason", "Jason's password")
org = gh.organization("Jason's organization with private repos")
repos = list(org.repositories(type="all"))  # Or type="private"

github3.py将为您处理分页(正如Jason在对您的问题的评论中提到的那样),这就是为什么您可能在调用list时包装组织存储库的迭代。 github3.py一次生成100个存储库(而不是默认的30个),因此您应该快速获取100个存储库,然后等待一秒钟等待下一个100个存储库。