Github API: Fetch issues with exceeds rate limit prematurely

99封情书 提交于 2019-12-05 18:42:55

The public GitHub API requests are limited to 60 / hour / ip, like you observed. That's why you need authentication.

There are multiple ways to get authenticated when you use the GitHub APIs.

Basic authentication

Basically, you provide the username and the password.

curl -u your-username "https://api.github.com/repos/user/repo/issues?state=closed"

This will prompt you for entering the password.

If you dont want to use the password, you can use a personal token:

curl -u username:token "https://api.github.com/repos/user/repo/issues?state=closed"

Using personal access tokens

This is my favorite, but make sure you don't share the token code with others. To generate a new token, open this page, and you will create the token.

Then you can use it like this:

curl "https://api.github.com/repos/user/repo/issues?state=closed&access_token=token"

(replace the token snippet at the end of the url with your token code)

OAuth

If you want to implement authentication for other users, you should use OAuth. The docs are good in this direction.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!