您的位置:首页 > 博客中心 > 互联网 >

示例:自动登录抽屉新热榜

时间:2022-05-08 11:48

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

 

技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片技术图片

本类排行

今日推荐

热门手游