response.cookies 是对象 再get_dict() 返回的是字典
访问上一次登录状态要有cookie
get和post都有cookies
import requests post_dict = { "phone": ‘8615131255089‘, ‘password‘: ‘woshiniba‘, ‘oneMonth‘: 1 } response = requests.post( url="http://dig.chouti.com/login", data=post_dict ) print(response.text) cookie_dict = response.cookies.get_dict() print(cookie_dict) response = requests.get( url=‘http://dig.chouti.com/profile‘, cookies=cookie_dict ) print(response.text)
s2.py
原文地址:https://www.cnblogs.com/jintian/p/11391995.html
时间: 2024-10-08 14:13:12