我一直在尝试从本网站。
当我使用浏览器访问时,网站打开正常。
但是当我尝试使用 R 或 Python 时,出现了一些错误,例如:Error in open.connection(x, "rb"): error:0A000152:SSL routines::unsafe legacy renegotiation disabled
。我该如何解决?
我尝试下载证书并将其放在与网页抓取文件相同的文件夹中,例如这里.但是没有解决
我的 R 脚本:
# Definindo url
url <- "https://cnae.ibge.gov.br/?view=secao&tipo=cnae&versaosubclasse=10&versaoclasse=7&secao=A"
# Configurando proxy
#httr::set_config(httr::use_proxy(url = url, port = 8080))
sessao_inicial <- httr::GET(url)
#> Error in curl::curl_fetch_memory(url, handle = handle): error:0A000152:SSL routines::unsafe legacy renegotiation disabled
page = rvest::read_html(url)
#> Error in open.connection(x, "rb"): error:0A000152:SSL routines::unsafe legacy renegotiation disabled
我的 Python 脚本
import requests
concla = requests.get('https://cnae.ibge.gov.br/?view=secao&tipo=cnae&versaosubclasse=10&versaoclasse=7&secao=A', verify="scripts/certificado_para_webscrap.pem")
#SSLError: HTTPSConnectionPool(host='cnae.ibge.gov.br', port=443):
#Max retries exceeded with url: /?view=secao&tipo=cnae&versaosubclasse=10&versaoclasse=7&secao=A
#(Caused by SSLError(SSLError(1, '[SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled
#(_ssl.c:997)')))
我一直在使用 Pop Os 22.04。