I am trying to connect to websites via proxies. I am using the python library requests
.
proxies = {
"http": "http://x.x.x.x:pn",
"https": "https://x.x.x.x:pn"
}
request_result = requests.get("https://www.iplocation.net/find-ip-address", proxies=proxies)
These configuration is correct, according to the documentation. I have one proxy from a paid site and I have tried several others that are available on the web. I have also configured this proxies in the windows settings and used them in the browser, it works.
When making the request through Python I get this error:
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.iplocation.net', port=443): Max retries exceeded with url: /find-ip-address (Caused by SSLError(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:852)'),))
This post says I should check the TLS-version, my environment support TLS 1.2. This post says I should have pyOpenSSL and idna installed, which I do. Why does it say unknown protocol, the request library should be able to connect with Https?
If change the url in the get() function to use the http protocol I sometimes receive:
(Caused by ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response',)))
On other occasions I receive a 502 http response.
It is quite frustrating because it should be working. I understand it is a hard question to answer with limited information. Can you give me any suggestions of what might be wrong.