python: certificate verified failed

I was just trying to download a file on github (raw) using wget package (or curl) under Python2.7.11 and Windows 7. I got a certificate error as follows:

As an example, here is the code with a Python shell

This is not an issue with the tool wget since I got the same message in a windows shell with curl.

After quite a lot of time on stackoverflow and other resources, I finally found a solution on a github page (https://github.com/servo/servo/issues/5917). his may work for other systems so here is the solution that worked for me:

This entry was posted in Python and tagged , . Bookmark the permalink.

20 Responses to python: certificate verified failed

  1. Pingback: Quicky: If Python and OpenSSL hate each other – 0daylego

  2. Anonymous says:

    Thanks. Had a similar issue.

  3. Anonymous says:

    it worked!

  4. MRF says:

    Thanks. It worked.

  5. kodi says:

    Great & Thanks.

  6. Abe says:

    Many thanks, you saved my time

  7. kino says:

    Thanx…. i try to find this solution in many sites…. some came with a lot of code’s line, and still result unexpected..
    but in this blog, you give me just 4 line of codes … and it works like magic ..
    Blessed your day

  8. Kim says:

    I spent hours looking for a solution to this problem. Thanks to you I finally got back to my coding class! Thanks a lot

  9. Al says:

    import ssl
    ssl._create_default_https_context = ssl._create_unverified_context

    This one did the trick – ignore SSL certificate verification!

  10. Mike says:

    You saved my bacon, this was annoying the living hell out of me

  11. Zen says:

    Thanks a lot it works

  12. shobhit says:

    thanks a lot , it worked for me

  13. Anonymous says:

    you are my hero

  14. egigoka says:

    Thank you very much!

  15. Vivek says:

    Thank you so much! It saved me from combing the web for hours more to find a solution.

  16. murat enes says:

    Omg ! 🙂 this great thank you

  17. MK says:

    Awesome. Works great. Many thanks!

  18. Anonymous says:

    What’s the solution when I run “python -m wget url_name” I have the same issue.

    • indeed, several comments reported this error. I have now updated the content of the section related to python 3.6.
      The main message being that in python 3.6 dictionary keeps insertion sorted, which means you do not need to sort them if one takes care of the sorting. Of course, if insertion are not sorted, you still need to perform the sorting.

  19. John says:

    Thank god! I was gonna throw my computer into a fire

Leave a Reply

Your email address will not be published.