I've tried to execute a GET with python requests on a Website (that perfectly works when visited with Firefox or Google Chrome) but it fails with the following exception:
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.example.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1091)')))
the interesting thing is that if I execute the GET on an other Subdomain (of the same website) it is:
- api.example.com Exception
- app.example.com It Works
and BOTH are certified with the SAME ROOT CA and both works on Firefox or Google Chrome.
In particular the code is the following (a very simple request)
import requests
import json
s = requests.Session()
# execute the get
r = s.get("https://api.example.com/"
and Throws the Exception:
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.example.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1091)')))
Insted if I execute:
r = s.get("https://app.example.com/"
it works without any problem!
And I remark that boot are Signed and Cerfiticated by the same Root CA. And Both works correctly if visited with Firefox or Google Chrome.
I don't know what to do... Thanks for any hint...
p.s. All the CAs are updated to the latest version.
And the versions of the packages are:
- urllib3-1.26.6
- certifi-2021.5.30