I initially installed my Python version from the Windows Store and it worked fine for almost a year on my Windows 10 computer. Then I started getting this error message when trying to use the requests library on all HTTP requests:
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.example.com', port=443): Max retries exceeded with url: /oauth/token?grant_type=client_credentials (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))
Apparently my Python certificates were not valid or up to date on my computer. These are “.PEM” or “.cert” files that certify your connection for the SSL protocol. I googled this error until I found the python-certifi-win32 library. I only needed to pip install this library and it fixed the problem:
pip install python-certifi-win32
Huge thank you to the maintainer of this package. It solved my issues and now I can make HTTP requests again!