twitteR R包OAuth问题:registerTwitterOAuth(cred)中的错误:oauth参数必须是OAuth类

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了twitteR R包OAuth问题:registerTwitterOAuth(cred)中的错误:oauth参数必须是OAuth类相关的知识,希望对你有一定的参考价值。

twitteR R Package OAuth issue: Error in registerTwitterOAuth(cred) :    
oauth argument must be of class OAuth

在我第一次进行身份验证后,这是我在R中用于加载身份验证的代码。

我一直收到错误:

Error in registerTwitterOAuth(cred) : oauth argument must be of class OAuth

来自以下代码:

download.file(url="http://curl.haxx.se/ca/cacert.pem", destfile="/xxx/xxx/xxx/cacert.pem")

# to get your consumerKey and consumerSecret see the twitteR documentation for instructions
cred <- OAuthFactory$new(consumerKey='xxxxxxxxx',
                         consumerSecret='xxxxxxxxx',
                         requestURL= NOTE UNABLE TO POST LINKS IN THE POST
                         accessURL = NOTE UNABLE TO POST LINKS IN THE POST
                         authURL= NOTE UNABLE TO POST LINKS IN THE POST)

# necessary step for Windows / Mac
cred$handshake(cainfo="/xxx/xxx/xxx/cacert.pem")

# save for later use for Windows / Mac
save(cred, file="/xxx/xxx/xxx/twitter authentication.Rdata")
cred <- load("/xxx/xxx/xx/twitter authentication.Rdata")
registerTwitterOAuth(cred)
答案

做就是了:

load("/xxx/xxx/xx/twitter authentication.Rdata")

代替:

cred <- load("/xxx/xxx/xx/twitter authentication.Rdata")

以上是关于twitteR R包OAuth问题:registerTwitterOAuth(cred)中的错误:oauth参数必须是OAuth类的主要内容,如果未能解决你的问题,请参考以下文章

尝试 OAuth 到 Twitter 时,无服务器 Django 应用程序(通过 Zappa 的 AWS Lambda)超时

在 Twitter 上验证 OAuth 令牌

Oauth - Facebook/Twitter/Foursquare

Twitter OAuth API 超时(Nginx 还是 Twitter?)

使用 oauth 和 twitter ruby​​ gem 时不断收到 OAuth::Unauthorized 错误

JavaScript OAuth 使用 Twitter 登录