关于 Python urllib3 ProxyManager 中SSL安全验证的问题

关于 Python urllib3 ProxyManager 中SSL安全验证的问题

最近自学python 遇到很多问题,耽误了很多时间,通过自己网上找各种答案终于解决了,希望对你们有帮助。`

        localurl = 'http://127.0.0.1:5000/random'
        ip_proxy = requests.get(url=localurl, headers=headers)
        proxies = ip_proxy.text
        proxies1 = 'http://%s' % (proxies)
        上面这部分是我搭建的IP池中请求IP数据
        proxy =urllib3.ProxyManager(proxies1,cert_reqs='CERT_REQUIRED', ca_certs=certifi.where())
        r =proxy.request('post', url + "/post", fields=fields, headers=header)`**
        上面这部分是正确的请求方式,能够正确返回值,记得import urllib3。之前报错`raise MaxRetryError(_pool, url, error or ResponseError(cause))

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘feedback.aliexpress.com’, port=443): Max retries exceeded with url: /display/productEvaluation.htm (Caused by ProxyError(‘Cannot connect to proxy.’, NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0x000001BC4C4BA6A0>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。’)))
Error([(‘SSL routines’, ‘tls_process_server_certificate’, ‘certificate verify failed’)])

参照以下文档:
https://www.jianshu.com/p/df9b883fecae
https://blog.csdn.net/taiyangdao/article/details/72825735
https://blog.csdn.net/fq_zhang/article/details/50906213

`

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值