GitHub的速率限制消息中剩余时间值的单位是多少?

时间:2015-04-17 20:21:51

标签: github-api

根据GitHub's API documentation,当您超过速率限制时,会得到如下响应:

HTTP/1.1 403 Forbidden
Date: Tue, 20 Aug 2013 14:50:41 GMT
Status: 403 Forbidden
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1377013266

{
    "message": "API rate limit exceeded for xxx.xxx.xxx.xxx. (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"
}

X-RateLimit-Reset值的单位是多少?换句话说,如何从错误消息中判断出我需要等待多长时间才能发送另一个请求?

1 个答案:

答案 0 :(得分:1)

这是一个Unix时间戳,请参阅this note from the GitHub API documentation

使用该示例的时间戳,重置时间将是2013年8月20日15:41:06。

根据Wikipedia article the GitHub docs link to,Unix时间戳是:

  

定义为1970年1月1日星期四00:00:00协调世界时(UTC)以来经过的秒数,不计算闰秒。