我目前正在尝试从R发送tweet,但无法绕过以下错误:
Error in .self$twFromJSON(out) :
Error: Could not authenticate with OAuth.我遵循了twitteR vignette中的说明和关于这个问题的其他堆栈溢出问题(http://stackoverflow.com/questions/8122879/roauth-on-windows-using-r),但似乎没有一个能绕过这个错误。下面是我使用的代码:
library("twitteR")
library('ROAuth')
requestURL <- "https://api.twitter.com/oauth/request_token"
accessURL = "http://api.twitter.com/oauth/access_token"
authURL = "http://api.twitter.com/oauth/authorize"
consumerKey = "*****************************"
consumerSecret = "************************"
Cred <- OAuthFactory$new(consumerKey=consumerKey,
consumerSecret=consumerSecret,
requestURL=requestURL,
accessURL=accessURL,
authURL=authURL)
Cred$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))
registerTwitterOAuth(Cred)通过这里就可以了。registerTwitterOAuth返回TRUE,所以您会认为一切都正常。但是当我尝试发送tweet时,我得到了上面列出的错误。
我正在尝试发送一条推文,如下所示:
tweet("text to tweet")这将导致:
Error in .self$twFromJSON(out) :
Error: Could not authenticate with OAuth.不知道哪里出了问题。OAuth验证似乎起作用了,但是我无法发送tweet。
发布于 2012-02-21 23:00:05
这个希望已经用我昨天上传的版本解决了。如果你还没有使用0.9.1版本的ROAuth,你能更新你的包并重试吗?
发布于 2013-05-15 11:32:21
我只是更新了twitteR和ROAuth包,并运行了这些命令,一切都为我工作:
cred = getTwitterOAuth(consumerKey, consumerSecret)
registerTwitterOAuth(cred)
tweet("something incredibly interesting...")似乎twitterR现在提供了一个更干净的接口来注册OAuth凭据,这不需要显式地使用OAuthFactory$new或handshake调用。当我尝试显式调用这些函数时,事情开始崩溃。但当我使用上面的界面时,一切都很顺利。
https://stackoverflow.com/questions/9373157
复制相似问题