开发者

RGoogleDocs (or RCurl) giving SSL certificate problem

开发者 https://www.devze.com 2023-01-11 06:58 出处:网络
I was using one of my favorite R packages today to read data from a google spreadsheet. It would not work. This problem is occurring on all my machines (I use windows) and it appears to be a new probl

I was using one of my favorite R packages today to read data from a google spreadsheet. It would not work. This problem is occurring on all my machines (I use windows) and it appears to be a new problem. I am using Version: 0.4-1 of RGoogleDocs

library(RGoogleDocs)
ps <-readline(prompt="get the password in ")
sheets.con = getGoogleDocsConnection(getGoogleAuth("fxxxh@gmail.com", ps, service ="wise"))
ts2=getWorksheets("OnCall",sheets.con)

And this is what I get after running the last line.

Error in curlPerform(curl = curl, .opts = opts, .encoding = .encoding) : SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

I did some reading and came across some interesting, but not useful to me at least, information.

When I try to interact with a URL via https, I get an error of the form

Curl: SSL certificate problem, verify that the CA cert is OK

I got the very big picture message but did not know how to implement the solution in my script. I dropped the following line before getWorksheets.

x = getURLContent("https://www.google.com", ssl.verifypeer = FALSE)

That did not work so I tried

ts2=getWorksheets("OnCall",sheets.con,ssl.verifypeer = FALSE)

That also did not work.

Interestingly enough, the following line works

getDocs(sheets.con,folders = FALSE)

What do you suggest I try to get it working again?开发者_运维百科 Thanks.


I no longer have this problem. I do not quite remember the timeline of exactly when I overcame the problem and cannot remember who helped me get here but here is a typical session which works.

library(RGoogleDocs)
if(exists("ps")) print("got password, keep going") else ps <-readline(prompt="get the password in ")  #conditional password asking
options(RCurlOptions = list(capath = system.file("CurlSSL", "cacert.pem", package = "RCurl"), ssl.verifypeer = FALSE))
sheets.con = getGoogleDocsConnection(getGoogleAuth("fjh@gmail.com", ps, service ="wise")) 
#WARNING: this would prevent curl from detecting a 'man in the middle' attack
ts2=getWorksheets("name of workbook here",sheets.con)
names(ts2)
sheet.1 <-sheetAsMatrix(ts2$"Sheet 1",header=TRUE, as.data.frame=TRUE, trim=TRUE) #Get one sheet
other <-sheetAsMatrix(ts2$"whatever name of tab",header=TRUE, as.data.frame=TRUE, trim=TRUE) #Get other sheet

Does it help you?


Maybe you don't have the certificate bundle installed. I installed those on OS X. You can also find them on the curl site

0

精彩评论

暂无评论...
验证码 换一张
取 消