python学习笔记
#requests import requests #from class_005.http_resuest import HttpRequest login_url = "http://api.nnzhp.cn/api/user/login" data = {'username':'niuhanyang', 'passwd':'aA123456' } res=requests.post(login_url,data) print(res.cookies) url= "http://api.nnzhp.cn/api/user/gold_add" data = {'stu_id':1, 'gold':100} res1cv =requests.post(url,data,cookies=res.cookies) #print(res.cookies) #print("响应头",res.headers) #headers是字典格式 #print("响应状态码",res.status_code) #print("响应正文",res) #响应体,只有返回是什么类型的就要用什么类型来接收。 #html xml json print(res.json()) #只能接受json格式的响应体 #print(res.text) #响应体有xml、json、html格式,可以用response.text来接收 #print(res.cookies)