SSL Handshake error when using proxy with requests library

Viewed 305
url = "https://google.com"
session = requests.session()
proxy = {
        "http": "http://REDACTED:12345",
        "https": "https://REDACTED:12345"
    }
r = session.get(url, headers={'User-Agent': get_random_agent()}, proxies=proxy)
print(r.status_code)

I am trying to make a get request with a proxy via the requests library. I have the above code snippet to demonstrate what I am trying to do. This snippet is working on one PC I have. However, I just recently got a new PC and when trying to execute the same code snippet on my new PC, I get this error -

TimeoutError: _ssl.c:980: The handshake operation timed out

If I remove proxies=proxy it works fine on my new PC. I have openssl 1.1.1 installed and python 3.10.

0 Answers
Related