Unable to connect to proxy. Your proxy appears to only use HTTP and not HTTPS, try changing your pro

使用代理IP访问网站时出现的问题

使用代理IP代码大概如下:
proxy = {
‘http’:‘http://’ + proxy_host,
‘https’:‘https://’ + proxy_host
}
r = requests.get(url, proxies = proxy)

错误一:

requests.exceptions.ProxyError: HTTPSConnectionPool(host=‘stock2.finance.sina.com.cn’, port=443): Max retries exceeded with url: /futures/api/jsonp.php/=/InnerFuturesNewService.getFewMinLine?symbol=V2401&type=1 (Caused by ProxyError(‘Unable to connect to proxy. Your proxy appears to only use HTTP and not HTTPS, try changing your proxy URL to be HTTP. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#https-proxy-error-http-proxy’, SSLError(SSLError(1, ‘[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1122)’))))

原因分析:

通过错误提示只使用HTTP而不使用HTTPS,因此将代理IP里面的HTTPS直接删掉即可。

修改如下:

proxy = {
‘http’:‘http://’ + proxy_host
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值