我正在尝试使用以下方式访问开放 APIhttr
,并且没有运气。每当我尝试:
httr::GET("https://api.openaq.org/v1/countries")
我收到以下错误:
Error in curl::curl_fetch_memory(url, handle = handle) :
SSL connect error
但是,其他 https 连接也可以正常工作,例如
httr::GET("https://httpbin.org/get")
这是输出sessionInfo()
:
R version 3.2.3 (2015-12-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.3 LTS
locale:
[1] LC_CTYPE=en_CA.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_CA.UTF-8 LC_COLLATE=en_CA.UTF-8
[5] LC_MONETARY=en_CA.UTF-8 LC_MESSAGES=en_CA.UTF-8
[7] LC_PAPER=en_CA.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
loaded via a namespace (and not attached):
[1] httr_1.0.0.9000 R6_2.1.2 tools_3.2.3 curl_0.9.5
在终端,如果我运行curl-config --version
I get
libcurl 7.35.0
更新:我尝试过的事情
- 确认这是 Ubuntu 14.04 的 libcurl3 的最新版本
- 使用检查 ssl 证书
openssl
as in 这个答案 https://stackoverflow.com/a/33917311/1727133
- 已卸载/重新安装
curl
, RCurl
and httr
- 证实了这一点DOES从终端工作:
curl -v "https://api.openaq.org/v1/countries"
我无法理解命令行curl如何正常工作,但是curl
在 R 中失败
更多更新——verbose
不起作用
我尝试通过询问从 R 获取更多信息httr
变得冗长。它产生相同的错误:
httr::GET("https://api.openaq.org/v1/countries", httr::verbose())
Error in curl::curl_fetch_memory(url, handle = handle) :
SSL connect error
与httr::GET("https://api.openaq.org/v1/countries", httr::verbose(ssl=TRUE))