我用Python https://stat.gov.kz/important/classifier做了一个简单的get请求。当我和邮递员或戈朗做同样的请求时--我没有问题。效果很好。使用Python时,我得到以下错误:
requests.exceptions.ProxyError: HTTPSConnectionPool(host='stat.gov.kz', port=443):
Max retries ***exceeded with url: /important/classifier (Caused by ProxyError
('Your proxy appears to only use HTTP and not HTTPS, try changing your proxy URL
to be HTTP.
See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#https-proxy-error-http-proxy',
SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:997)'))))
***
我的代码很简单:
import requests
url = "https://stat.gov.kz/important/classifier"
payload={}
headers = {
'Content-Type': 'application/json; charset=utf-8',
'Cookie': 'cookiesession1=678B774D30541450DAF79D7FA70C889F'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
我用verify=False做的-没有效果。我做什么好?
发布于 2022-11-08 05:35:42
正如错误说的那样:
您的代理似乎只使用HTTP而不是HTTPS,请尝试将代理URL更改为HTTP。
所以把你的网址改为
url = "http://stat.gov.kz/important/classifier"
可能有用。
否则,尝试手动设置代理(SSL: WRONG_VERSION_NUMBER ON PYTHON REQUEST):
proxies = {'https': 'http://<Proxy-ip>:<Proxy-Port>'}
request = r.get('https://stat.gov.kz/important/classifier', verify=False, proxies=proxies)
https://stackoverflow.com/questions/74355950
复制相似问题