不为别的,只为做一个连自己都羡慕的人

jupyterlab认证用户的cookie获取

import requests

# 30d7b203e5c672987745da8986a5583720b63477c87df775是用户用来登录的token或者密码 headers
= { 'Authorization': 'Token 30d7b203e5c672987745da8986a5583720b63477c87df775', "X-XSRFToken": "123" } login_url = "http://127.0.0.1:8888/login?next=%2F" r = requests.post(login_url, headers=headers, allow_redirects=False, data={'username': 'root', 'password': '30d7b203e5c672987745da8986a5583720b63477c87df775'}) r.raise_for_status() cookies = r.cookies print(cookies) print(cookies.values()[0])

运行结果如下所示:

posted @ 2022-05-26 17:07  升级打怪  阅读(163)  评论(0编辑  收藏  举报