0

I am doing a simple get request with Python to url https://stat.gov.kz/important/classifier. When I do same request with Postman or on Golang - I have no problem. Works perfectly. Buu with Python I get following error:

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)'))))
***


My code is simple:

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)

I did it with verify=False - no effect. What do I do?

  • Adding `verify=False` to your code is working for me. What's the exact error? – shaik moeed Nov 08 '22 at 05:45
  • I tried to add verify=False, I've got the same error - the text didn't change a bit. 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)')))) –  Nov 08 '22 at 05:52

1 Answers1

0

As the error said:

Your proxy appears to only use HTTP and not HTTPS, try changing your proxy URL to be HTTP.

So changing your url to

url = "http://stat.gov.kz/important/classifier"

might work.

Otherwise try to set Proxies manually (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)
PHagemann
  • 71
  • 5
  • I did try to do this, I got the same error. 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)')))) –  Nov 08 '22 at 05:50