一、https请求加cookies
import requests
#课堂派注册接口,用fidder抓包
login_url=‘https://v4.ketangpai.com/UserApi/login‘#https认证失败
login_data={"email":"18201028551","password":"shi1988922","remember":0}
#登陆请求方式是post
login_request=requests.post(login_url,login_data,verify=False)#跳过https认证
login_request.json()
#获取响应结果
#print(login_request.text)
cookies=login_request.cookies
#2、课堂派考勤接口,用fidder抓包
kq_url=‘https://v4.ketangpai.com/SummaryApi/attence?courseid=MDAwMDAwMDAwMLOGx5WIubts‘
kq_request=requests.get(kq_url,cookies=cookies,verify=False)
#查看考勤结果
print(kq_request.text)
二、请求加session第二种方法:
import requests
#课堂派注册接口,用fidder抓包
login_url=‘https://v4.ketangpai.com/UserApi/login‘#https认证失败
login_data={"email":"**********","password":"******","remember":0}
#登陆请求方式是post
s=requests.session()#加session方法
s.post(login_url,login_data,verify=False)#跳过https认证
#课堂派考勤接口
kq_url=‘https://v4.ketangpai.com/SummaryApi/attence?courseid=MDAwMDAwMDAwMLOGx5WIubts‘
kq_request=s.get(kq_url,verify=False)##跳过https认证
print(kq_request.text)