问题检索={requests.exceptions.ConnectionError: HTTPConnectionPool(host=‘localhost’, port=8050): Max retries exceeded with url: /render.html?url=https://www.baidu.com (Caused by NewConnectionError(’<urllib3.connection.HTTPConnection object at 0x03907AF0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。’))}
原文代码

但是我忘记了,我的splash网址已经变了(splash网址变换可参考如下文章)
https://blog.youkuaiyun.com/Omann/article/details/105114739
因此,在代码中更改正确的splash网址代码即可
import requests
url = 'http://192.168.99.100:8050/render.html?url=https://www.baidu.com'
response = requests.get(url)
print(response.text)
再次运行

成功!
本文解决了一个常见的编程问题:当尝试使用Splash服务时遇到连接错误。通过更改代码中Splash的URL地址,成功地解决了由目标计算机积极拒绝导致的连接失败。
609





