【问题标题】:Remote end closed connection without response when using a proxy使用代理时远程结束关闭连接而无响应
【发布时间】:2021-10-21 02:47:09
【问题描述】:

我正在使用来自this anwser 的以下代码。

import urllib.request
url = 'https://example.com'
proxy_support = urllib.request.ProxyHandler({'http' : '37.26.86.206', 
                                             'https': '37.26.86.206'})
opener = urllib.request.build_opener(proxy_support)
urllib.request.install_opener(opener)

with urllib.request.urlopen(url) as response:
    print(response)

但是,我收到此错误:urllib.error.URLError: <urlopen error Remote end closed connection without response> 我不知道为什么会这样,因为其他人没有这个问题(我可以找到)。这是我的proxy 的问题,还是代码的问题?
注意:所有回溯都是通过 urllib,而不是我的程序

【问题讨论】:

  • 免费代理通常已经过时并且无法正常工作。一些门户网站已经知道免费代理,他们可能会阻止它们。最好找一些付费代理或者使用tor 作为代理。或者使用像 scrapestack.com 这样的服务,每个月提供很少的免费请求(即 250)

标签: python proxy urllib urlopen


【解决方案1】:

我认为问题在于我没有 IP 端口。现在已经修复了。

【讨论】:

    猜你喜欢
    • 2021-08-20
    • 2018-11-08
    • 1970-01-01
    • 1970-01-01
    • 2021-04-09
    • 2017-03-12
    • 2020-12-30
    • 1970-01-01
    • 2021-10-17
    相关资源
    最近更新 更多