我尝试废弃this页面以获取所有维修人员的清单,但我遇到了一些困难。
目前,我有这个错误:
requests.exceptions.SSLError:HTTPSConnectionPool(host =' www.renault-retail-group.fr',port = 443):使用url超出最大重试次数:/concessions-renault.html(由SSLError(SSLError(1,' [SSL:CERTIFICATE_VERIFY_FAILED]证书验证失败(_ssl.c:777)'),))
我的剧本:
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
from random import randint
import time
url = "https://www.renault-retail-group.fr/concessions-renault.html"
chrome_path = r"C:\Users\XXX\Desktop\chromedriver_win32 (1)\chromedriver.exe"
driver = webdriver.Chrome(chrome_path)
driver.maximize_window()
try:
driver.get(url)
except TimeoutError:
driver.execute_script("window.stop();")
time.sleep((randint(2, 3)))
r = requests.get(url)
soup = BeautifulSoup(r.content, "html.parser")
g_data = soup.findAll("div", {"class": "audColResultatConcessionDetail"})
dict_name_r = []
for item in g_data:
dict_name_r(item.contents[1].findAll("h6", {"class": "audColResultatConcessionNom ng-binding"}))
print(dict_name_r)
非常感谢你的帮助