美文网首页
爬虫 代理 报错 Connection refused

爬虫 代理 报错 Connection refused

作者: blaze冰叔 | 来源:发表于2019-07-24 14:59 被阅读0次
proxy_handler = ProxyHandler({
    'http':'http://127.0.0.1:9743',
    'https':'http://127.0.0.1:9743'
})
opener = build_opener(proxy_handler)
try:
    response = opener.open('https://www.baidu.com')
    print(response.read().decode('utf-8'))
except URLError as e:
    print('throw error: %s' % e.reason)
throw error: [Errno 61] Connection refused

删除 'https':'http://127.0.0.1:9743' 即可

相关文章

网友评论

      本文标题:爬虫 代理 报错 Connection refused

      本文链接:https://www.haomeiwen.com/subject/qnpxrctx.html