1

我一直在尝试使用以下脚本通过 ROAuth 进行身份验证:

    library("ROAuth")
    library("RCurl")

requestURL <- "https://api.twitter.com/oauth/request_token"
accessURL = "https://api.twitter.com/oauth/access_token"
authURL = "https://api.twitter.com/oauth/authorize"


cKey<- "Key"
cSecret<- "Secret"


Cred <- OAuthFactory$new(consumerKey=cKey,
            consumerSecret=cSecret,
            requestURL=requestURL,
            accessURL=accessURL,
            authURL=authURL)

Cred$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))

每次输入此代码时,我都会收到错误消息:

Error in Cred$handshake(cainfo = system.file("CurlSSL", "cacert.pem",  : Invalid response from site, please check your consumerKey and consumerSecret and try again.

我不确定我做错了什么。通过重新安装 ROauth 和 RCurl 并检查它们的版本信息(ROAuth 0.9.1 和 RCurl_1.91-1.1(?) ),我确保每个必要的包都是最新的。安装后,我重新启动了 R(作为另一篇文章建议的可能解决方案)。我复制粘贴并仔细检查了消费者密钥和消费者秘密,我确信它们是正确的。有没有人有任何其他想法?

谢谢你。

4

2 回答 2

1

显然 ROauth 中的握手方法已损坏,但已修复。您发布的错误消息(与我现在收到的相同)与以下链接中引用的错误消息相同:

http://lists.hexdump.org/pipermail/twitter-users-hexdump.org/2012-February/000059.html

我猜还有一个问题,所以我会看看我是否能找到其他任何东西......

于 2012-10-30T23:07:09.960 回答
0

我对 RCurl/ROAuth 无能为力——但你可以试试这个包 ‛httr‛ https://github.com/hadley/httr/。它带有一个演示如何访问 Twitter。

于 2012-07-30T20:17:33.333 回答