【问题标题】:GitHub API to list repositories of an user does not list all repositories列出用户存储库的 GitHub API 未列出所有存储库
【发布时间】:2015-10-01 05:34:19
【问题描述】:

我在 Python 中开发一个数据分析工具只是为了好玩,我想找出用户或组织以每种语言编写的代码量(以字节为单位)。

脚本运行良好,但问题是 GitHub API 端点在经过身份验证和未经身份验证的请求中仅输出大约 30 个存储库。

例如端点 https://api.github.com/users/google/repos 输出 29 个存储库 json 对象,https://api.github.com/orgs/google/repos 输出 26 个 json 对象。

显然 google 有比这更多的存储库,那么我该如何访问它们呢? 我只想为我的脚本获取存储库的 URL。

有什么想法吗?

【问题讨论】:

    标签: python github github-api


    【解决方案1】:

    https://api.github.com/orgs/google/repos 为我返回 30 个存储库,这是预期的行为。 GitHub API 不会在单个响应中返回完整的项目列表。相反,列表将被分页,您可以使用此处描述的方法获取其他页面:

    https://developer.github.com/v3/#pagination

    【讨论】:

      猜你喜欢
      • 2012-10-04
      • 2013-01-01
      • 2015-08-30
      • 1970-01-01
      • 1970-01-01
      • 2021-07-11
      • 1970-01-01
      • 2013-09-09
      • 2021-04-24
      相关资源
      最近更新 更多