我正在从我的 python 脚本中调用 github api。如果运行成功,它将进行大约 3000 次调用。然而,在 50-60 次成功调用后,它显示以下消息 -
{'message': "API rate limit exceeded for 108.169.151.47. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", 'documentation_url': 'https://developer.github.com/v3/#rate-limiting'}
我已经阅读了文档。我没有任何可注册的应用程序来获取客户端 ID 和客户端密码。 从我的 github 帐户,我生成了一个 token 。我想知道我是否可以使用它来发送经过身份验证的请求。 我尝试了一些 curl 命令在 git bash 中通过我的 github 配置文件登录,然后运行 python 脚本,但它仍然显示相同的消息。
你能建议我如何利用消息中的好消息吗?
请您参考如下方法:
您可能想考虑使用 GitHub username 和 password 进行基本身份验证。收到的响应应转换为 JSON。
req = requests.get(url, auth=(USERNAME, PASSWORD))
req_json = req.json()
