requests发送http请求、https请求

tyl-bok / 2024-09-04 / 原文

requests是一个python的第三方库,用来发送http请求,也可以发送https请求
发送http请求:
url="http://xxxxx.com"
response=requests.get(url)

发送https请求:
http请求是在http的基础上加入了ssl协议,需要证书,要想发送https请求,可以在发送请求时,将verify设置为False即可
url="https://xxxxx.com"
response=requests.get(url=url,verify=False),即可跳过ssl协议的证书验证,verify默认是True