【发布时间】:2020-06-11 15:18:40
【问题描述】:
This url 在浏览器中工作,提供一些 JSON 数据。
它在 R 中一直有效,直到最近,它现在返回:
library(jsonlite)
fromJSON("https://api.worldbank.org/v2/country?format=json")
# Error in open.connection(con, "rb") :
# SSL certificate problem: certificate has expired
library(rvest)
read_html("https://api.worldbank.org/v2/country?format=json")
# Error in open.connection(con, "rb") :
# SSL certificate problem: certificate has expired
到目前为止我所知道的
我不确定这是 API 方面的问题,还是 R 中的某个问题?
- 似乎有一个类似的解决方案here,尽管我使用的任何解决方案都不能使用浏览器自动化 (selenium),而是必须使用 jsonlite 或 rvest
【问题讨论】:
-
我无法复制 - 两条线都可以正常工作。它似乎不是API。也许尝试不同的连接方法?也许
read_html(url("https://api.worldbank.org/v2/country?format=json", method= "libcurl")) -
@AllanCameron 谢谢艾伦。您能说出您使用的是哪个版本的 R 吗?我在 4.0.1
-
我现在使用的电脑运行的是旧版本:3.6.1
-
有趣。 This 相关问题也在运行 R 4。但这可能是巧合。
-
你尝试过不同的
method =看看是否修复了它史蒂夫?
标签: r ssl rvest rcurl jsonlite