requests.exceptions.SSLError:Replit.com 上的 HTTPSConnectionPool,

问题描述 投票:0回答:1

我在 Replit.com 上运行一个简单的代码,但出现错误。该代码一周前有效,但现在不起作用。该 URL 可通过浏览器访问且正常运行,不会出现任何问题。在网上寻找解决方案没有结果。我该如何解决以下错误?

import requests

url = ‘https://iss.moex.com/iss/statistics/engines/stock/markets/index/analytics.csv’
print(url)

r = requests.get(url).text
print (r)

回溯(最近一次调用最后一次):... requests.exceptions.SSLError: HTTPSConnectionPool(host=‘iss.moex.com’, port=443):最大重试次数 超出网址: /iss/statistics/engines/stock/markets/index/analytics.csv(由 SSLError(SSLEOFError(8, ‘[SSL: UNEXPECTED_EOF_WHILE_READING] EOF 发生违反协议的情况 (_ssl.c:1007)’)))

我尝试了这里的解决方案 HTTPSConnectionPool 已超出最大重试次数 没有结果

python ssl python-requests
1个回答
0
投票

当你过度运行代码时,就会发生错误。我曾经在遇到此类错误时使用代理。这是您可以尝试的解决方案之一的示例。

import requests

proxy = {
    'http': 'https:// ',#here you should put a new IP adress but try to choose a save one like from this page; https://www.proxy-list.download/HTTP
    'https': 'http://189.240.60.171:9090'
}

url = 'http://ejemplo.com'  # repalce here with the server of  Replit.com

response = requests.get(url, proxies=proxy)
print(response.text)  
© www.soinside.com 2019 - 2024. All rights reserved.