ssl 认证

http 和 https区别

-http:超文本传输协议
-https:安全的超文本传输协议
-https=http+ssl/tls
-防止:篡改,截取
-必须有证书:才能通信


使用方式

import requests

header = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36'
}
respone = requests.get('https://www.jianshu.com/',headers=header,verify=False)  # 不验证证书 
# respone = requests.get('https://www.jianshu.com/',headers=header,cert=('/path/server.crt','/path/key'))
print(respone.text)
posted @ 2024-02-19 16:33  wellplayed  阅读(177)  评论(0编辑  收藏  举报