When connecting to the internet we could be doing that :
- to install new packages/modules, or
- to make requests within the application, using
requests
module.
By either of them we could get SSLCertVerficationError, but each requires a different solution.
For the first scenario, using pip to install new modules, one could configure the .ini file and add the following lines
[global]
cert = C:\CA\my-ca-cert.crt
C:\CA\another-ca-cert.crt
trusted-host = pypi.python.org
pypi.org
files.pythonhosted.org
I have tried the python-certifi-win32
, which was not going smooth as it injected itself to all the calls, and when it made python, I wasn't even able to uninstall it except when I commented out the initialization in the module's .pth
file
I also tried pip-system-certs
, which simply didn't work, but I think that's related to being only working for the first scenario, AKA: pip.
The solution was to add a new environment variable REQUESTS_CA_BUNDLE
and set it to the .crt file that contains all the CA certificates, that I need requests
to consider alongside with certifi
's certificates.