我在使用 twitteR 包时遇到了麻烦,因为即使使用 ROAuth 进行注册,我仍然不能做废话。这是我的输入/输出
setwd("C:/")
download.file(url="http://curl.haxx.se/ca/cacert.pem", destfile="cacert.pem")
cred <- OAuthFactory$new(consumerKey=HIDDEN,
consumerSecret=HIDDEN,
requestURL="https://api.twitter.com/oauth/request_token",
accessURL="http://api.twitter.com/oauth/access_token",
authURL="http://api.twitter.com/oauth/authorize")
cred$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl") )
registerTwitterOAuth(cred)
结果是:
> cred$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl") )
To enable the connection, please direct your web browser to:
http://api.twitter.com/oauth/authorizeoauth_token=MNjWmBE7QzodHlK8yeyZC559iunb8urA8cGLamww
When complete, record the PIN given to you and provide it here:
> registerTwitterOAuth(cred)
[1] TRUE
但是当我尝试做某事时:
> rate.limit <- getCurRateLimitInfo( cainfo="cacert.pem")
[1] "Unauthorized"
Error in twInterfaceObj$doAPICall("application/rate_limit_status", params = params, :
Error: Unauthorized
我仍然收到未经授权的错误。
我到底应该在这里做什么?
哦,顺便说一句,我的 sessionInfo() 已附加:
R version 2.15.1 (2012-06-22)
Platform: x86_64-pc-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] plyr_1.7.1 stringr_0.6.1 ROAuth_0.9.2 digest_0.5.2
[5] twitteR_1.1.0 rjson_0.2.12 RCurl_1.95-4.1 bitops_1.0-4.1
loaded via a namespace (and not attached):
[1] tools_2.15.1