使用代理IP訪(fǎng)問(wèn)網(wǎng)站時(shí)出現(xiàn)的問(wèn)題
使用代理IP代碼大概如下:
proxy = {
‘http’:‘http://’ + proxy_host,
‘https’:‘https://’ + proxy_host
}
r = requests.get(url, proxies = proxy)
錯(cuò)誤一:
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)’))))
原因分析:
通過(guò)錯(cuò)誤提示只使用HTTP而不使用HTTPS,因此將代理IP里面的HTTPS直接刪掉即可。文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-852474.html
修改如下:
proxy = {
‘http’:‘http://’ + proxy_host
}文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-852474.html
到了這里,關(guān)于Unable to connect to proxy. Your proxy appears to only use HTTP and not HTTPS, try changing your pro的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!