I try to use https proxy in python like this:
proxiesDict ={
'http': 'http://' + proxy_line,
'https': 'https://' + proxy_line
}
response = requests.get('https://api.ipify.org/?format=json', proxies=proxiesDict, allow_redirects=False)
proxy_line is a proxy read from file in the format of ip:port. I checked this https proxy in browser and it works. But in python this code hangs for a few seconds and then i get exception:
HTTPSConnectionPool(host='api.ipify.org', port=443): Max retries exceeded with url: /?format=json (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x0425E450>: Failed to establish a new connection: [WinError 10060]
I tried to use socks5 proxy, and it works on socks5 proxies with a PySocks installed. But for https i get this exception, can someone help me
http://andhttps://? Also, what does a sampleproxy_linecontain? - cs95proxy_linecontains a proxy like this: 79.110.31.87:8085, and in the browser i see the same ip when visitingapi.ipify.org, but from python i get weird addresses - Mrs_HillaryClinTonallow_redirects=False. In your browser, redirects are allowed automatically. Let me know if removing that fixes it, I'll create an answer for posterity. - cs95set allow_redirects=Trueand it still same weird results, for example for proxy79.110.31.87:8085i got{"ip":"162.220.246.230"}i tried to ,make request to whoer.net and it display the same ip - Mrs_HillaryClinTon