简体   繁体   English

公共Github Pages站点上的Github API速率限制

[英]Github API rate limit on public Github Pages Site

I've setup a github pages site here: http://d3js.live 我在这里设置了一个github页面网站: http//d3js.live

This uses the github api to get gists for d3.js examples. 这使用github api获取d3.js示例的要点。 The end look and functionality is similar to this site: http://threejs.live 最终外观和功能类似于此站点: http//threejs.live

I'm getting a 403 error due to my rate limit being hit. 由于我的速率限制被击中,我收到403错误。 I understand that authenticating will increase my rate limit, however I'd like this site to be public. 我知道验证会增加我的速率限制,但我希望这个网站是公开的。 Because of this, I have a few questions: 因此,我有几个问题:

  1. Any rate limit would be an issue if the traffic were to increase. 如果流量增加,任何速率限制都将成为一个问题。 Is there a reasonable scenario where I can disable the rate limit for a public page? 是否有合理的方案我可以禁用公共页面的速率限制?
  2. If I were to authenticate with my user account, how would I create a server-side token on Github pages? 如果我要使用我的用户帐户进行身份验证,我将如何在Github页面上创建服务器端令牌? I want to confirm that this token won't be visible to the client. 我想确认客户端不会看到此令牌。 The repo is here: https://github.com/ekatzenstein/d3.js-live 回购在这里: https//github.com/ekatzenstein/d3.js-live
  3. Having the end user login with Github isn't an option. 让最终用户使用Github登录不是一种选择。 I want this to be a low-level of entry, especially for those not familiar with Github. 我希望这是一个低级别的入门,特别是对那些不熟悉Github的人。 Is it possible to tie the rate-limit per user? 是否可以将每个用户的速率限制联系起来?

Mike Bostock's bl.ocks seems to get around the rate limit but it's not clear to me how this is done. Mike Bostock的bl.ocks似乎已经达到了速度限制,但我不清楚这是如何完成的。

The best way to get around the limit is to write a simple back-end that makes the API requests to GitHub (or whoever), cache those results for some time to remain below the rate limit, and then serve all the required assets from that request to your users. 绕过限制的最好方法是编写一个简单的后端,向GitHub(或任何人)发出API请求,将这些结果缓存一段时间以保持低于速率限制,然后从中提供所有必需的资产请求您的用户。

If your JavaScript is polymorphic, it should be fairly trivial to put most of what you already have in a NodeJS server. 如果您的JavaScript是多态的,那么将您已有的大部分内容放在NodeJS服务器中应该是相当简单的。

As a general rule, this is probably what a tool like this should do, anyway. 作为一般规则,这可能是这样的工具应该做的事情。 Of course, given the trade-off required, arguments could be made either way. 当然,鉴于需要权衡,可以采用任何一种方式进行论证。

This is what bl.ocks seems to do, for example. 例如,bl.ocks似乎就是这样做的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM