requests、selenium爬虫处理:您的连接不是私密连接的网站(https ssl 证书)

requests、selenium爬虫处理:您的连接不是私密连接的网站(https ssl 证书)_第1张图片

requests的话verify参数设置为False

selenium的话添加参数:--ignore-certificate-errors

测试代码:

import requests
from selenium import webdriver


url='https://www.alshamelmag.com/'
options = webdriver.ChromeOptions()


res=requests.get(url,verify=False)
# res=requests.get(url)
print(res.text)

options.add_argument('--ignore-certificate-errors')
webdriver=webdriver.Chrome(options=options)
# webdriver=webdriver.Chrome()
webdriver.get(url)
print(webdriver.page_source)

参考:

https://stackoverflow.com/questions/24507078/how-to-deal-with-certificates-using-selenium/25063706#25063706

https://requests.readthedocs.io/en/master/user/advanced/#ssl-cert-verification

你可能感兴趣的:(requests、selenium爬虫处理:您的连接不是私密连接的网站(https ssl 证书))