GitHub页面https://developer.github.com/v3/rate_limit/显示速率限制状态,例如:
响应
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
X-RateLimit-Reset: 1372700873
{
"resources": {
"core": {
"limit": 5000,
"remaining": 4999,
"reset": 1372700873
},
"search": {
"limit": 30,
"remaining": 18,
"reset": 1372697452
}
},
"rate": {
"limit": 5000,
"remaining": 4999,
"reset": 1372700873
}
}
但只说我需要检查GET /rate_limit
。但是如何使用呢?我应该像这样做一个命令吗?
curl -i https://api.github.com/users/octocat GET /rate_limit
这个命令怎么样?
相关问题:
答案 0 :(得分:2)
您可以使用
调用此端点curl -H "Authorization: token OAUTH-TOKEN" -X GET https://api.github.com/rate_limit
Ruby中的或类似内容
require 'uri'
require 'net/http'
url = URI("https://api.github.com/rate_limit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["authorization"] = 'Authorization: token OAUTH-TOKEN'
response = http.request(request)
puts response.read_body