Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more

I am posting a request like this:

requests.post(URL, headers=HEADERS, cookies=COOKIES, data=DATA, proxies=proxy_list[ip_index], timeout=4)

and getting back the bellow error:

HTTPSConnectionPool(host='www.example.com', port=443): Max retries exceeded with url: /someurl (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)')))
                I think @nerdstrike somehow has answered the question. A similar solution posted here worked for me which tries to avoid the TSL verification putting 'https' : 'http://proxy-server:proxy-port'
– Elias
                Jan 27 at 11:47

Depending on your proxy settings, the proxy server can be to blame for this. If you have set an https_proxy to an https:// path the proxy server can interfere with the validation process of TLS. Changing this to an http://proxy.address allows the proxy server to open the connection, and then the TLS handshake to occur between host and destination.

It can be useful to try curl -v with similar settings to see what's going on, as the python ssl bindings can misinterpret/obscure errors from the underlying library.

At the root of this, I speculate that a recent update in long-term stable images of distros like Debian has led to a raft of these issues emerging where they were perhaps previously invisible.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid …

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.