gpt4 book ai didi

r - 网页在浏览器中工作,但不是来自 R : SSL certificate problem: certificate has expired

转载 作者:行者123 更新时间:2023-12-04 22:41:13 29 4
gpt4 key购买 nike

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
  • 最佳答案

    对于遇到类似问题的其他人

    原因

    网站所有者的 SSL 证书已过期。

    我可以通过 this 确认这一点网站:

    enter image description here

    (不完善)解决方案

    由于我无法控制 url 的 SSL 证书,我只是将我使用的所有 url 从 https 更改为至http .

    例如:

    "https://api.worldbank.org/v2/country?format=json"

    更改为
    "http://api.worldbank.org/v2/country?format=json"

    关于r - 网页在浏览器中工作,但不是来自 R : SSL certificate problem: certificate has expired,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62327694/

    29 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com