pythonssl-certificateurlliburlopen

urllib.requiest.urlopen error: certificate verify failed on python Virtual Environment


Im building a Web Scapper, when testing on venv -> [SSL: CERTIFICATE_VERIFY_FAILED] But, when I'm testing on ipython shell -> Perfectly good

I wondering what the root problem is? Thanks for your help!`from urllib.request import urlopen

from bs4 import BeautifulSoup import subprocess

html = urlopen('http://www.pythonscraping.com/pages/page3.html') bs = BeautifulSoup(html, 'lxml') html_tags = bs.prettify()`


Solution

  • Try installing pip install certifi with your venv and add another valid certificate from any website with https:

    10 ways to get valid ssl

    Also this is how you add a certificate to certifi library:

    adding certs to requests