避免错误 429 请求过多(Steam Web API) [英] Avoiding Error 429 Too Many Requests (Steam Web API)

查看:57
本文介绍了避免错误 429 请求过多(Steam Web API)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个显示从 Steam Web API 获取的信息的站点,但在测试时,我收到了 429 错误.没有迹象表明我可以提出另一个请求需要多长时间,并且已经超过 3 个小时.我听说每天有 100,000 次通话限制,但我没有达到这个数字.

I'm trying to make a site that displays information obtained from the Steam Web API but while testing, I received a 429 error. There is no indication for how long until I can make another request and its been over 3 hours. I've read that there is a 100,000 daily call limit but I didn't reach anywhere near that number.

我试图接收的信息是我所有朋友(大约 100 个)的个人资料,以获取他们的个人资料图片以及我最近玩的游戏和他们的成就.每次有人访问网页时都会调用该信息,并且我在网站上工作时使用的是实时服务器(每次我保存并重新加载浏览器时都会发出请求).我猜我可能已经快速拨打了很多电话,但有没有更好的设计来解决我想要做的事情?

The information I was trying to receive was the profiles of all my friends (around 100) to get their profile picture as well as the games I have recently played and their achievements. The information is called every time someone visits a web page and I was using a live server while working on the site (it made requests every time I saved and the browser reloaded). I'm guessing I might have made to many calls to quickly but is there a better design to approach what I am trying to do?

推荐答案

每天 100,000 个来自 Steam API条款和条件 但是,Steam 似乎在较短的时间内估计了费率.如果您在 google 周围搜索,您会发现许多人将 5 分钟内的呼叫限制为每 5 分钟 200 次左右.

The 100,000 a day is from the Steam API Terms and Conditions however, its seems that Steam estimates the rate over shorter periods. If you google around you'll see that many people limit the calls on a 5-minute bucket to around 200 per 5-minutes.

当然,我们的做法是定义一个bucket,每次调用都会增加一个计数器.如果计数器达到该存储桶的限制,我们将暂停任何新调用,直到下一个存储桶.

Certainoly the way we do it is define a bucket and every time a call is made increment a counter. If the counter hits the limit for that bucket we pause any new calls until the next bucket.

如果你打电话给个人资料,在短时间内为 100 人玩过游戏和成就,可能会超过限制.

If you were making a call for the proifile, played games and achievements for 100 people in a short period of time that may push it over the limit.

当返回 429 时,您可能会发现更多信息,请在您下次致电时询问 在标题中.

When a 429 is returned you may find More information abotu when you can call next in the headers.

这篇关于避免错误 429 请求过多(Steam Web API)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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