【问题标题】:ROAuth Handshake Error (Twitter API 443) using twitteR使用 twitteR 的 ROAuth 握手错误 (Twitter API 443)
【发布时间】:2020-05-04 15:53:31
【问题描述】:

我正在尝试通过 R 访问 Twitter API,并且我的代码在“握手”时中断——其他所有内容(以及不需要握手的后续代码)都可以正常工作。同样,我让一位朋友在她的计算机上尝试了相同的代码(以及我的 OAuth 信息),结果成功。

requestURL <- "https://api.twitter.com/oauth/request_token"
accessURL <- "https://api.twitter.com/oauth/access_token"
authURL <- "https://api.twitter.com/oauth/authorize"
consumerKey <- "X"
consumerSecret <- "Y"
my_oauth <- OAuthFactory$new(consumerKey=consumerKey, consumerSecret=consumerSecret, 
    requestURL=requestURL, accessURL=accessURL, authURL=authURL)

my_oauth$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))

save(my_oauth, file = 'Twitter_TokenNFH')
load('Twitter_TokenNFH')

这是我正在尝试的代码,我得到的错误是:

函数错误(类型、msg、asError = TRUE):未知的 SSL 协议 与 api.twitter.com:443 连接时出错

有什么想法吗?

我的会话信息是:

Session info ---------------------------------------------------------------
 setting  value                       
 version  R version 3.6.2 (2019-12-12)
 os       Windows 10 x64              
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  English_United States.1252  
 ctype    English_United States.1252  
 tz       America/Los_Angeles         
 date     2020-01-17                  

- Packages -------------------------------------------------------------------
 package     * version   date       lib
 assertthat    0.2.1     2019-03-21 [1]
 backports     1.1.5     2019-10-02 [1]
 bit           1.1-15.1  2020-01-14 [1]
 bit64         0.9-7     2017-05-08 [1]
 bitops      * 1.0-6     2013-08-17 [1]
 boot        * 1.3-24    2019-12-20 [2]
 callr         3.4.0     2019-12-09 [1]
 cli           2.0.1     2020-01-08 [1]
 coda        * 0.19-3    2019-07-05 [1]
 colorspace    1.4-1     2019-03-18 [1]
 crayon        1.3.4     2017-09-16 [1]
 DBI           1.1.0     2019-12-15 [1]
 desc          1.2.0     2018-05-01 [1]
 devtools    * 2.2.1     2019-09-24 [1]
 digest        0.6.23    2019-11-23 [1]
 dplyr         0.8.3     2019-07-04 [1]
 ellipsis      0.3.0     2019-09-20 [1]
 fansi         0.4.1     2020-01-08 [1]
 fs            1.3.1     2019-05-06 [1]
 ggplot2       3.2.1     2019-08-10 [1]
 glue          1.3.1     2019-03-12 [1]
 gtable        0.3.0     2019-03-25 [1]
 httr          1.4.1     2019-08-05 [1]
 igraph      * 1.2.4.2   2019-11-27 [1]
 jsonlite      1.6       2018-12-07 [1]
 knitr         1.26      2019-11-12 [1]
 lattice       0.20-38   2018-11-04 [2]
 lazyeval      0.2.2     2019-03-15 [1]
 lifecycle     0.1.0     2019-08-01 [1]
 magrittr      1.5       2014-11-22 [1]
 memoise       1.1.0     2017-04-21 [1]
 munsell       0.5.0     2018-06-12 [1]
 ndjson      * 0.8.0     2019-11-13 [1]
 pillar        1.4.3     2019-12-20 [1]
 pkgbuild      1.0.6     2019-10-09 [1]
 pkgconfig     2.0.3     2019-09-22 [1]
 pkgload       1.0.2     2018-10-29 [1]
 prettyunits   1.1.0     2020-01-09 [1]
 processx      3.4.1     2019-07-18 [1]
 ps            1.3.0     2018-12-21 [1]
 purrr         0.3.3     2019-10-18 [1]
 R2WinBUGS   * 2.1-21    2015-07-30 [1]
 R6            2.4.1     2019-11-12 [1]
 Rcpp          1.0.3     2019-11-08 [1]
 RCurl       * 1.95-4.12 2019-03-04 [1]
 remotes       2.1.0     2019-06-24 [1]
 rjson       * 0.2.20    2018-06-08 [1]
 rlang         0.4.2     2019-11-23 [1]
 ROAuth      * 0.9.6     2015-02-13 [1]
 rprojroot     1.3-2     2018-01-03 [1]
 rstudioapi    0.10      2019-03-19 [1]
 rtweet      * 0.7.0     2020-01-08 [1]
 scales        1.1.0     2019-11-18 [1]
 sessioninfo   1.1.1     2018-11-05 [1]
 streamR     * 0.4.5     2018-12-09 [1]
 testthat      2.3.1     2019-12-01 [1]
 tibble        2.1.3     2019-06-06 [1]
 tidyselect    0.2.5     2018-10-11 [1]
 tweetscores * 0.2.1     2020-01-16 [1]
 twitteR     * 1.1.9     2015-07-29 [1]
 usethis     * 1.5.1     2019-07-04 [1]
 withr         2.1.2     2018-03-15 [1]
 xfun          0.12      2020-01-13 [1]
 yaml          2.2.0     2018-07-25 [1]

【问题讨论】:

    标签: r twitter


    【解决方案1】:

    我在使用 tweetscores 库时遇到了同样的问题。每次握手都没有用。

    经过长时间的尝试,解决方案是在 Linux 中安装 R 和 RStudio。每台装有 Windows 的计算机,该软件包都会出现协议问题。

    在 Windows 10 中,有一种方法可以在没有虚拟机或双启动的情况下使用 Linux。只需尝试使用 WSL 2,安装 Linux 版本,下载 GUI 界面并安装 R 和 RStudio。

    我希望这也对你有用。

    一些帮助我安装 OS 和 R 的教程: https://www.zdnet.com/article/how-to-run-run-the-native-ubuntu-desktop-on-windows-10/ https://askubuntu.com/questions/993225/whats-the-easiest-way-to-run-gui-apps-on-windows-subsystem-for-linux-as-of-2018 https://ecosang.github.io/blog/miscellaneous/wsl/ https://virtualizationreview.com/articles/2017/02/08/graphical-programs-on-windows-subsystem-on-linux.aspx

    【讨论】:

    • 嗨帕洛玛!谢谢!我实际上刚买了一台 Mac,它现在可以工作了。真的是一样的分辨率。
    猜你喜欢
    • 2012-07-28
    • 2014-07-29
    • 2013-07-22
    • 2016-02-03
    • 1970-01-01
    • 2013-08-12
    • 2017-11-13
    • 2013-12-11
    • 1970-01-01
    相关资源
    最近更新 更多