新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Python教程:Python無法驗證ssl證書怎么解決

python無法驗證ssl證書?解決方法如下:
相關(guān)推薦:《Python教程》
import requests
from bs4 import BeautifulSoup
import time
import re
url = 'https://music.163.com/#/search/m/?s=%E7%BA%A2%E6%98%AD%E6%84%BF&type=100'
#header必須是以字典的形式出現(xiàn)
header = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome
/72.0.3626.121 Safari/537.36'}
#s = requests.session()
#請求時發(fā)生SSL驗證失敗,解決方法是讓requests忽略對SSL證書的驗證
#在沒有verify=False時會出現(xiàn)SSLError
web_url = requests.get(url,headers=header,verify=False)
soup = BeautifulSoup(web_url.content,'lxml')
print(web_url.text) 當前文章:創(chuàng)新互聯(lián)Python教程:Python無法驗證ssl證書怎么解決
文章出自:http://m.5511xx.com/article/cddopdc.html


咨詢
建站咨詢
