我甚至从第一个请求就达到了价格限制 [英] I hit the rate limit for twitteR even from the first request

查看:121
本文介绍了我甚至从第一个请求就达到了价格限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如我在标题中所述,即使从第一个请求开始,我也始终达到速率限制(据说).因此,我无法从Twitter下载任何内容.

As I say in the title, I always hit the rate limit (supposedly) even from the first request. Therefore, I cannot download anything from twitter.

这是我在R中的示例代码:

Here is my example code in R:

tweets = searchTwitter('blabla', n=1, cainfo = "cacert.pem")

我一直收到此消息:

[1] "Too Many Requests"
[1] "Rate limited .... blocking for a minute ..."

我可以尝试什么?

reqURL <- "http://api.twitter.com/oauth/request_token"
accessURL <- "http://api.twitter.com/oauth/access_token"
authURL <- "http://api.twitter.com/oauth/authorize"
consumerKey <- "KEY"
consumerSecret <- "KEY"
twitCred <- OAuthFactory$new(consumerKey=consumerKey,
                         consumerSecret=consumerSecret,
                         requestURL=reqURL,
                         accessURL=accessURL,
                         authURL=authURL)
twitCred$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))
registerTwitterOAuth(twitCred)
tweets = searchTwitter('blabla', n=10, cainfo = "cacert.pem")

上面的代码.没有明显的原因,我设法下载了一些推文,但有时我仍然不断收到此消息.

The code is the above. Without any apparent reason, I managed to download some tweets but sometimes I still keep getting this message.

此外,我正在搜索一个字符串,尽管我100%确信它存在于twitter上,但我找不到它.我收到一条消息,称未从服务器检索到任何响应.

Moreover, I'm searchong for a string and I cannot find it although I'm 100% sure that it exists on twitter. I'm getting a message that no response was retrieved from the server.

推荐答案

我也遇到了同样的问题.但是我认为原因是新的Twitter API将其速率限制"设置为在15分钟内仅允许15次调用.

I got the same problem, too. But I think the reason is that the new Twitter API sets its "rate limits" to only allow 15 calls in 15 minutes.

因此,如果您超出速率限制,您的帐户将被屏蔽一段时间. 但是再过15分钟,您将可以访问数据. (它对我有用!您可以尝试.)

Therefore, if you exceed the rate limitation, your account will be blocked for a while... But you'll be able to access the data after another 15 mins. (It works for me! You may try.)

供您参考: http ://www.tweetings.net/site/2012/10/rate-limits-and-the-new-twitter-api/

这篇关于我甚至从第一个请求就达到了价格限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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