question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate ve rify failed (_ssl.c:661)>

See original GitHub issue

Heads up!

We appreciate any bug reports or other contributions, but please note that this issue tracker is only for this client library. We do not maintain the APIs that this client library talks to. If you have an issue or questions with how to use a particular API, you may be better off posting on Stackoverflow under the google-api tag. If you are reporting an issue or requesting a feature for a G Suite API, please use their public issue tracker

Thank you!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (5 by maintainers)

github_iconTop GitHub Comments

14reactions
ghostcommented, Jul 3, 2018

This helped resolve my issue: Thanks to the blog by Yifan Peng : http://blog.pengyifan.com/how-to-fix-python-ssl-certificate_verify_failed/

I added the below code:

import os, ssl
if (not os.environ.get('PYTHONHTTPSVERIFY', '') and
    getattr(ssl, '_create_unverified_context', None)): 
    ssl._create_default_https_context = ssl._create_unverified_context
2reactions
mcdonccommented, Jul 24, 2018

For the record, this error is almost certainly due to the following combination of events:

  • The certificate database of the operating system on which the script is run is outdated.

  • You are running Python 2 >= 2.7.9 or Python 3 >= 3.4

In these versions of Python, SSL certificate verification is turned on by default (in previous versions, it was turned off by default). The solution is to update your OS’ certificate database, which differs greatly per OS.

For more information:

https://www.python.org/dev/peps/pep-0476/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python urllib2 ssl certificate verify failed error - Stack Overflow
I'm trying to connect to an internal site using urlopen. And it's failing repeatedly with SSL error irrespective of providing cafile.
Read more >
[Solved] urllib.error.URLError: [SSL - Clay-Technology World
[Solved] urllib.error.URLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed ... I never got this error in the past, and it seems ...
Read more >
[Solved - urllib and “SSL: CERTIFICATE_VERIFY_FAILED” Error
SSLError : [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749) During handling of the above exception, another exception occurred: ...
Read more >
Error urllib and SSL CERTIFICATE VERIFY FAILED - Edureka
This code makes the verification undone so that the ssl certification is not verified. Hope it works!!
Read more >
Urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] - Help
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)> Setting letsencrypt/status.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found