import requests
from bs4 import BeautifulSoup
from urllib.request import Request, urlopen
html = urlopen("https://www.familyeducation.com/baby-names/browse-origin/surname/german")
soup = BeautifulSoup(html)
metadata=soup.find_all('meta')
urlopen错误[SSL:CERTIFICATE_VERIFY_FAILED]
答案 0 :(得分:0)
对于此错误,请查看以下答案: urllib and "SSL: CERTIFICATE_VERIFY_FAILED" Error
但是您不必总是为urlopen
使用html request
。您也可以通过requests
lib发送请求。试试这个:
import requests
from bs4 import BeautifulSoup
html = requests.get("https://www.familyeducation.com/baby-names/browse-origin/surname/german")
soup = BeautifulSoup(html.text, "html.parser")
metadata = soup.find_all('meta')