Python requests module exception SSLError occurs only in PyCharm but not in other IDEs

While using PyCharm I am getting a requests module exception error when I try to access the website. I am not having problems using the Python requests module with any other website when I am using PyCharm. If I try the same requests command from an IDE other than PyCharm it works correctly. Here is a sample of my code:
import requests
initialURL = ''
r = requests.get(initialURL)
When I run this code I get an error message that terminates with:
requests.exceptions.SSLError: HTTPSConnectionPool(host='', port=443): Max retries exceeded with url: /investors/ (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:645)'),))

An internet search indicates that the problem might be with acastipharma's SSL certificate. I tried installing pyopenssl to make sure I had the latest version of the module thats checks SSL certificates but that did not solve the problem. I also tried running the requests.get statement with the verify=False option but that was also unsuccessful.

r = requests.get(initialURL, verify=False)

If anybody has any ideas on how to get requests to work in this situation in PyCharm I would appreciate the help.

1 comment

It turns out the problem was two-fold. The first problem was the version of OpenSSL that the project interpreter I was using was deprecated.  I also had two versions of Python 3.5 on my system and whenever I would attempt to update a package (ie. OpenSSL) the version of python that was not used by my project interpreter would update rather than the version of Python 3.5 I was using for the project interpreter. I ended up installing Python 3.7 and creating a project interpreter based on Python 3.7. By having only one version of 3.7 on my system I was able to update the OpenSSL package specifically associated with 3.7 and the problem went away.


Please sign in to leave a comment.