wordpress   发布时间:2022-04-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了TwitteR,ROAuth和Windows:注册确定,但证书验证失败大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我试图通过twitteR获得大量Twitter用户的数量.许多 other questions发布对我来说非常有用,但是似乎没有一个与我的问题直接相关,只要我能看到. 我可以将OAuth凭据注册到twitter R会话,但是我根本看不到什么,我只是得到这个消息: 函数中的错误(类型,msg,asError = TRUE):   SSL证书问题,验证CA证书是否正常.细节: 错误:14090086:
我试图通过twitteR获得大量Twitter用户数量.许多 other questions发布对我来说非常有用,但是似乎没有一个与我的问题直接相关,只要我能看到.

我可以将OAuth凭据注册到twitter R会话,但是我根本看不到什么,我只是得到这个消息:

函数中的错误(类型,msg,asError = TRUE)
SSL证书问题,验证CA证书是否正常.细节:
错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败

当我使用twitteR功能而不使用OAuth时,他们可以正常工作,没有错误或警告,但是我碰到限制和受保护的帐户,我以为我可以避免使用OAuth.

以下是详细信息:

library(twitteR)
library(roauth)
library(RCurl)
#
# Here's how I register my credentials
#
requestuRL <-  "https://api.twitter.com/oauth/request_token"
accessURL =    "https://api.twitter.com/oauth/access_token"
authURL =      "https://api.twitter.com/oauth/authorize"
consumerKey =   "------------"
consumerSecret = "-----------"
twitCred <- OAuthFactory$new(consumerKey=consumerKey,consumerSecret=consumerSecret,requestuRL=requestuRL,accessURL=accessURL,authURL=authURL)
download.file(url="http://curl.haxx.se/ca/cacert.pem",destfile="cacert.pem")
twitCred$handshake(cainfo="cacert.pem")
To enable the connection,please direct your web browser to: 
https://api.twitter.com/oauth/authorize?oauth_token=xxxx
When complete,record the PIN given to you and provide it here: xxxxxx
registerTwitteroauth(twitCred)
[1] TRUE
# so the OAuth bit appears to be ok...
#
# save it for a future sessions...
save(list="twitCred",file="twitteR_credentials")
# works,in future I can just
load("twitteR_credentials")
registerTwitteroauth(twitCred)
#
# try to get follower numbers,here's where it goes south
me <- getUser("Rbloggers")
me$followersCount
Error in function (type,asError = TRUE)  :
SSL certificate problem,verify that the CA cert is OK. Details:
error:14090086:SSL routInes:SSL3_GET_SERVER_CERTIFICATE:certificate verify Failed
#
# another method,same problem
getUser("Rbloggers")$followersCount
Error in function (type,asError = TRUE)  : 
SSL certificate problem,verify that the CA cert is OK. Details:
error:14090086:SSL routInes:SSL3_GET_SERVER_CERTIFICATE:certificate verify Failed
# 
# Here are the packages and versions I'm using
sessionInfo() 
R version 2.14.1 (2011-12-22)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252   
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.1252    

attached base packages:
[1] stats4    stats     graphics  Grdevices utils     datasets  methods   base     

other attached packages:
 [1] roauth_0.9.2      digest_0.5.1      twitteR_0.99.19   rjson_0.2.6       RCurl_1.91-1.1   
 [6] bitops_1.0-4.1    igraph_0.5.5-4    topicmodels_0.1-4 tm_0.5-7          slam_0.1-23      
[11] modeltools_0.2-18 lasso2_1.2-12    

loaded via a namespace (and not attached):
[1] tools_2.14.1

注册我的凭证后,如何使twitteR功能正常工作?

更新:尝试@ Btibert3的建议给出了相同的错误

> ## Authenticate with Twitter = this is an important peice of code
> registerTwitteroauth(cred)
[1] TRUE
> ##########################################################################
> ## lets test out what our session limits look like
> ##########################################################################
> rate.limit <- getCurRateLimiTinfo()
Error in function (type,asError = TRUE)  : 
  SSL certificate problem,verify that the CA cert is OK. Details:
error:14090086:SSL routInes:SSL3_GET_SERVER_CERTIFICATE:certificate verify Failed

updatE以下@ flz的建议添加cainfo =“cacert.pem”无处不在修复了我的问题:

rate.limit <- getCurRateLimiTinfo( cainfo="cacert.pem")
rate.limit
                             resource limit remaining               reset
1                  /lists/subscribers   180       180 2013-03-27 09:35:37
2                         /lists/list    15        15 2013-03-27 09:35:37
3                  /lists/memberships    15        15 2013-03-27 09:35:37
4                   /lists/ownerships    15        15 2013-03-27 09:35:37
5                /lists/subscriptions    15        15 2013-03-27 09:35:37
6                      /lists/members   180       180 2013-03-27 09:35:37
7             /lists/subscribers/show    15        15 2013-03-27 09:35:37
8                     /lists/statuses   180       180 2013-03-27 09:35:37
9                         /lists/show    15        15 2013-03-27 09:35:37
10                /lists/members/show    15        15 2013-03-27 09:35:37
11     /application/rate_limit_status   180       179 2013-03-27 09:35:37 (etC)

会话信息

sessionInfo()
R version 2.15.3 (2013-03-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 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] roauth_0.9.2   digest_0.6.3   twitteR_1.1.0  rjson_0.2.12   RCurl_1.95-4.1 bitops_1.0-5  

loaded via a namespace (and not attached):
[1] tools_2.15.3
尝试:
getUser("Rbloggers")$followersCount
Error in function (type,verify that the CA cert is OK. Details:
error:14090086:SSL routInes:SSL3_GET_SERVER_CERTIFICATE:certificate verify Failed
getUser("Rbloggers",cainfo="cacert.pem")$followersCount
[1] 2752

每个get / update操作都需要一个cainfo =“cacert.pem”.那个烦人

大佬总结

以上是大佬教程为你收集整理的TwitteR,ROAuth和Windows:注册确定,但证书验证失败全部内容,希望文章能够帮你解决TwitteR,ROAuth和Windows:注册确定,但证书验证失败所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。