Office365-REST-Python-Client icon indicating copy to clipboard operation
Office365-REST-Python-Client copied to clipboard

[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129)

Open macgilly opened this issue 1 year ago • 0 comments

Hello guys, I'm trying to connect to Sharepoint online. But its throwing some error that I can't seem to get around it. I've search but can't seem to find any suitable solutions. So any help or pointers would be much appreciated.
I'm using Windows 10, Python 3.9.16 with Office365-REST-Python-Client 2.5.8 . I followed this walk through to generate the certs and key https://help.alteryx.com/current/en/designer/data-sources/microsoft-sharepoint/create-certificate-for-sharepoint-list-app-only-authentication.html#create-certificate-for-sharepoint-list-app-only-authentication

As soon as it get the .execute_query() it crashes.

`cert_creds = { "tenant": tenantID, "client_id": clientID, "thumbprint": thumbprint, #"private_key":private_key, "cert_path": certPath, "passphrase": PEMpass }

conn = ClientContext(spSite).with_client_certificate(**cert_creds) web = conn.web.get().execute_query() print("Site Title: {0}".format(web.properties['Title']))`

the error:

requests.exceptions.SSLError: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /4asdse3-667-4587-93dfs352t3/v2.0/.well-known/openid-configuration (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129)')))

macgilly avatar Jul 15 '24 00:07 macgilly