我正在使用 google app engine 并想下载给定用户的推文。
我只是调用http://api.twitter.com/1/statuses/user_timeline/USERNAME.json
但几乎总是(大约 99% 的时间)我收到“超出速率限制。客户每小时不能发出超过 150 个请求”这个问题是否与 Google App Engine Cloud 基础设施有关?我该怎么办? (例如将数据存储在其他服务器上,然后从那里调用...)
最佳答案
does this problem has something to do with Google App Engine Cloud inrastructure
是的。
您调用的 API 方法是 rate-limited :
The default rate limit for calls to the REST API is 150 requests per hour. The REST API does account- and IP-based rate limiting. Authenticated API calls are charged to the authenticating user's limit while unauthenticated API calls are deducted from the calling IP address' allotment.
如果您的应用有专用 IP,这会很好用;在 App Engine 上,许多应用程序可能会为其 urlfetch 请求使用相同的源 IP,因此对 Twitter API 的未经身份验证的请求都将使用相同的配额。
我没有对此进行测试,但我的理解是,即使对于不需要身份验证的调用,如果您选择对您的请求进行身份验证,它将计入您的帐户配额而不是共享 IP 配额。
尼克·约翰逊发布了 a tutorial关于如何从 App Engine 向 Twitter 发送经过身份验证的 API 调用。
关于google-app-engine - 推特速率限制超过谷歌应用引擎,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3284205/