When REQUESTS_CA_BUNDLE is defined, the CA certificate passed to requests.Session constructor is overridden when requests.Session.request is called.
Guilty method/lines:
https://github.com/psf/requests/blob/master/requests/sessions.py#L694-L710
I would expect for the priority to be:
requests.Session.request verify kwargrequests.Session verify propertyREQUESTS_CA_BUNDLE / CURL_CA_BUNDLEAs requests.Session.request verify kwarg was not set, it took the value from REQUESTS_CA_BUNDLE and only then requests.Session.verify was checked, but ignored, resulting in an invalid CA used (for that Session).
Related issue (in docker-py project) https://github.com/docker/docker-py/issues/2433
$ python -m requests.help
{
"chardet": {
"version": "3.0.4"
},
"cryptography": {
"version": "2.7"
},
"idna": {
"version": "2.8"
},
"implementation": {
"name": "CPython",
"version": "3.7.4"
},
"platform": {
"release": "18.6.0",
"system": "Darwin"
},
"pyOpenSSL": {
"openssl_version": "1010103f",
"version": "19.0.0"
},
"requests": {
"version": "2.22.0"
},
"system_ssl": {
"version": "1000213f"
},
"urllib3": {
"version": "1.25.3"
},
"using_pyopenssl": true
}
Same issues I presume:
https://github.com/psf/requests/issues/4938
https://github.com/home-assistant/home-assistant-cli/issues/184
Had also opened a pull request, hopefully one of them gets merged in. This is a tiresome issue.
https://github.com/psf/requests/pull/5172
This looks like a duplicate of https://github.com/psf/requests/issues/3829
Most helpful comment
Same issues I presume:
https://github.com/psf/requests/issues/4938
https://github.com/home-assistant/home-assistant-cli/issues/184
Had also opened a pull request, hopefully one of them gets merged in. This is a tiresome issue.
https://github.com/psf/requests/pull/5172