python cookies 模拟登录

s = requests.session()
r = s.get(url, headers=headers,verify=False)
 print s.cookies
# 添加登录需要的两个cookie
1 c = requests.cookies.RequestsCookieJar()
c.set('.CNBlogsCookie', 'xxx')  # 填上面抓包内容
c.set('.Cnblogs.AspNetCore.Cookies','xxx')  # 填上面抓包内容
s.cookies.update(c)
print s.cookies.get_dict()

r2 = s.post(url2, data=body, verify=False)

评论

刷新

友情链接