Requests SSL certificate verification error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

项月亮
1 min readFeb 16, 2020

--

Python module requests rarely meet SSL certifiacte errors such as requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852).These errors may occurs beacause of target sites’ or your computer’s improper configuration of SSL certificate. To aviod this error, the best solution is reconfigure the certificate of your device. But if you can not ensure the reason that causes this error, you can simply turn off the SSL validation process of requests by follwing code

import requestsurl = "https://www.japonx.net"
response = requests.get(url, verify=False)

But meanwhile, there is also a annoying warning message InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised every time when requests send out a connection request. To disable this warning, furtherly input this piece of code to instead of the above code.

from requests.packages.urllib3.exceptions import InsecureRequestWarningrequests.packages.urllib3.disable_warnings(InsecureRequestWarning)url = "https://www.japonx.net"
response = requests.get(url, verify=False)

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response