如何查看我的GitHub当前速率限制? [英] How to check my GitHub current rate limit?

查看:12
本文介绍了如何查看我的GitHub当前速率限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

此命令效果如何?


相关问题:

  1. GitHub API limit exceeded: how to increase the rate limit in front-end apps
  2. jspm saying "github rate limit reached" - how to fix?
  3. Github API: Fetch issues with exceeds rate limit prematurely
  4. https://developer.github.com/v3/#rate-limiting

推荐答案

您可以使用

调用此终结点
curl -H "Authorization: token YOUR-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"] = 'token YOUR-OAUTH-TOKEN'

    response = http.request(request) 
    puts response.read_body

这篇关于如何查看我的GitHub当前速率限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆