I have a python app that connects to google calendar when it opens. It stopped working at my job after infrastructure updated our security. Now, whenever I run it, it gives me this error
google.auth.exceptions.TransportError: HTTPSConnectionPool(host='oauth2.googleapis.com', port=443): Max retries exceeded with url: /token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)')))
I spoke with cybersecurity, and they sent me 2 .pem certificat to approve on my app, but they didn't said how to do it.
I researched a lot online, I tried this:
Import SSL
ca_cert1_path = "V:\test2.pem"
ca_cert2_path = "V:\RootCA5.pem"
context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
context.load_verify_locations(cafile=ca_cert1_path)
mcontext.load_verify_locations(cafile=ca_cert2_path)
but it didn't worked, still giving me the same error.
I also Tried this which gave me the same error again:
requests.get('https://oauth2.googleapis.com', verify=False)
Here is the complete error :
Traceback (most recent call last):
File "requests\adapters.py", line 449, in send
File "urllib3\connectionpool.py", line 725, in urlopen
File "urllib3\util\retry.py", line 439, in increment
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='oauth2.googleapis.com', port=443): Max retries exceeded with url: /token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "google\auth\transport\requests.py", line 181, in __call__
File "requests\sessions.py", line 530, in request
File "requests\sessions.py", line 643, in send
File "requests\adapters.py", line 514, in send
requests.exceptions.SSLError: HTTPSConnectionPool(host='oauth2.googleapis.com', port=443): Max retries exceeded with url: /token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)')))
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "main.py", line 7, in <module>
File "main_controller.py", line 16, in __init__
File "quickstart.py", line 48, in initiate_calendar_service
File "google\oauth2\credentials.py", line 210, in refresh
File "google\oauth2\_client.py", line 248, in refresh_grant
File "google\oauth2\_client.py", line 105, in _token_endpoint_request
File "google\auth\transport\requests.py", line 186, in __call__
File "<string>", line 3, in raise_from
google.auth.exceptions.TransportError: HTTPSConnectionPool(host='oauth2.googleapis.com', port=443): Max retries exceeded with url: /token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)')))
[47456] Failed to execute script 'main' due to unhandled exception!
Any help would be appreciated
BTW, the app works on ANY personnal pc. The code ISN'T the problem. It doesn't work on any pc connected at my job (under my job's network).