python-scraping icon indicating copy to clipboard operation
python-scraping copied to clipboard

[SSL: CERTIFICATE_VERIFY_FAILED] on pythonscraping

Open Ryan-Bringenberg opened this issue 2 years ago • 5 comments

When running the code in the first two chapters that use pythonscraping.com I receive the following error:

<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1125)>

Ryan-Bringenberg avatar May 06 '22 17:05 Ryan-Bringenberg

我已收到您的邮件,谢谢!

JosephWhang avatar May 06 '22 17:05 JosephWhang

@Ryan-Bringenberg you need to use this code import ssl ssl._create_default_https_context = ssl._create_unverified_context

Example:

from urllib.request import urlopen import ssl ssl._create_default_https_context = ssl._create_unverified_context

html = urlopen('http://pythonscraping.com/pages/page1.html') print(html.read())

scarbear06 avatar Jun 21 '22 23:06 scarbear06

我已收到您的邮件,谢谢!

JosephWhang avatar Jun 21 '22 23:06 JosephWhang

I update my system, in conda: conda update -n base -c defaults conda

Xnac avatar Jun 24 '22 20:06 Xnac

@scarbear06 - Why is that not included in the book already? Or is there a way to update our system to have that automatically run with the script?

gitchegumee11 avatar Apr 15 '24 17:04 gitchegumee11