I have tried everything. I can't handle it anymore. Please I need help (LOL)!
My first question was there : How to make my python app accept 2 certificates of authority?
But finaly, I don'T need to accept the 2 .pem, just 1 of them.
The Coding Penguin helped me, now i only have this error :
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)
I have my organization .pem file, and i have the cacert.pem file. I tried both on :
response = requests.get('http://www.googleapis.com', verify = r'C:\Path\to\cacert.pem' )
and
response = requests.get('http://www.googleapis.com', verify = r'C:\Path\to\work.pem' )
I keep having the same error.
I don't want to use verify = false
These are all my imports. Nothing is working :
import pip_system_certs.wrapt_requests
import requests
import pickle
import os.path
import ssl
import certifi
This is the block of code where there is an issue, it's when it connects to the calendar service that it blocks everything :
def initiate_calendar_service():
"""Shows basic usage of the Google Calendar API.
Prints the start and name of the next 10 events on the user's calendar.
"""
creds = None
# The file token.pickle stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
if os.path.exists('token.pickle'):
with open('token.pickle', 'rb') as token:
creds = pickle.load(token)
# If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file(
'credentials.json', SCOPES)
creds = flow.run_local_server(port=0)
# Save the credentials for the next run
with open('token.pickle', 'wb') as token:
pickle.dump(creds, token)
service = build('calendar', 'v3', credentials=creds)
return service