【问题标题】:How to format request for github api如何格式化 github api 的请求
【发布时间】:2020-03-05 10:35:35
【问题描述】:

我在格式化对 github api 的请求时遇到问题。 我试过查看documentation 并做:

https://api.github.com/repos/facebook/react/commits/master?since=2019-01-01&until=2019-12-30

但这只会返回一个结果,而不是当年的所有提交。我在 python 中使用 requests 库,并且也在浏览器中本地尝试过。 任何帮助表示赞赏,谢谢。

【问题讨论】:

    标签: rest url github-api url-parameters


    【解决方案1】:

    您正在使用Single Commit APIGET /repos/:owner/:repo/commits/:ref

    你需要List commits APIGET /repos/:owner/:repo/commits

    https://api.github.com/repos/facebook/react/commits?since=2019-01-01&until=2019-12-30&sha=master

    您可以使用sha 参数指定分支。如果你想要默认的分支,你可以省略这个字段:

    https://api.github.com/repos/facebook/react/commits?since=2019-01-01&until=2019-12-30

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-07
      • 2013-04-17
      • 1970-01-01
      • 2018-04-11
      • 1970-01-01
      • 1970-01-01
      • 2017-04-24
      • 2014-05-11
      相关资源
      最近更新 更多