python requests module使用cookie的两种方法

来源:互联网 发布:云计算企业投融资政策 编辑:程序博客网 时间:2024/06/01 10:41
import requestscookie = dict(JSESSIONID="C0814388AAC36FBCA25639BED4F007F5")print(cookie)r = requests.get("http://baison.yunz.com.cn/shopping-mall/rest/orders/list.html?size=1", cookies=cookie)print(r.text)#Another methodheaders = {    "cookie": "JSESSIONID=C0814388AAC36FBCA25639BED4F007F5",}r = requests.get("http://baison.yunz.com.cn/shopping-mall/rest/orders/list.html?size=1", headers=headers)print(r.text)


既然cookie是在请求头里面发送的,我们当然也可以在request header 里面说明

0 0