nithinmurali / pygsheets

Google Sheets Python API v4
https://pygsheets.readthedocs.io/en/latest
Other
1.51k stars 220 forks source link

SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076) #507

Closed pikku1 closed 3 years ago

pikku1 commented 3 years ago

Note, if this is a usage question, please ask a question in stackoverflow with pygsheets tag.

Describe the bug SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)

We are using pygsheets as module in our python scripts and its throwing the below error. Please help me on this. SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)

nithinmurali commented 3 years ago

This doesn't look like an issue specific to pygsheets. Could you please give some more info like, which function call is throwing this error. and other conditions like, are you inside a vpn or if you are facing this issue in specific situations?

pikku1 commented 3 years ago

Hey Nithin,

We are using Global Protect as VPN and after SSL decryption project, the user is getting error while running the python scripts,when he is using pygsheets as module in his scripts. If we enroll the user out of the decryption rule on firewall, he is able to run the scripts well without errors. As we need to enroll users under decryption project, we need to fix this issue as why the module is not happy getting decrypted.

pikku1 commented 3 years ago

Hey Nithin,

Can you please look into this and help to resolve the issue.

nithinmurali commented 3 years ago

Hi @pikku1, Your error seems very specific to your use-case and it doesn't look like a library fix. But I have few suggestions, you can try fixing this by creating a custom client with custom http object to client. here.

# try disabling ssl verification
import httplib2
 h = httplib2.Http(disable_ssl_certificate_validation=True)

# or you can try passing custom ca cert
h = httplib2.Http(ca_certs='./ca.crt')
nithinmurali commented 3 years ago

Also try to get the sample code from google sheets api docs to work. if so pygsheets should also work without any issues.

pikku1 commented 3 years ago

Hey Nithin,

I am trying the above suggestion provided by you and would let you know how it works. Thank you so much for looking into it.

nithinmurali commented 3 years ago

closing as this issue is unrelated to pygsheets code.