SSL certificate failed for twitteR in R

后端 未结 3 907
醉梦人生
醉梦人生 2020-12-30 02:46

I know similar questions have been asked again. However, I\'ve tried everything I found here and on google and nothing seems to work for me.

My code is the following

相关标签:
3条回答
  • 2020-12-30 03:12

    Do the following first, and then run your code:

    library(RCurl) 
    
    # Set SSL certs globally
    options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")))
    

    This usually corrects the issue you were experiencing.

    EDIT (Aug 2014): Or better yet, try to use the httr package instead (which is a friendly wrapper of RCurl with useful default options set for you)

    0 讨论(0)
  • 2020-12-30 03:27

    finally i got the solution, please try this method. this is very easy

    library(devtools)
    install_github("twitteR", username="geoffjentry")
    library(twitteR)
    
    api_key = "aaa"
    api_secret = "bbb"
    access_token = "ccc"
    access_token_secret = "ffffd"
    setup_twitter_oauth(api_key,api_secret,access_token,access_token_secret)
    
    0 讨论(0)
  • 2020-12-30 03:29

    You might need to update your cacert.pem file. See here and here for links to other questions regarding this. I see this hasn't worked for other people using download.file(), but this might using Curl directly. You can update your bundle file like so:

    system( paste0( "curl http://curl.haxx.se/ca/cacert.pem -o " , tempdir() , "/cacert.pem" ) )
    #Then you can use it like so
    twitCred$handshake( cainfo = paste0( tempdir() , "/cacert.pem" ) )
    

    HTH

    0 讨论(0)
提交回复
热议问题