我正在尝试在Python中使用请求时保持登录状态。我曾尝试使用会话和cookie,但我始终收到413无效的会话错误。这是我的代码:
s = requests.Session()
url = "http://"+edge_server+":7780/xtvschedule/rest//UserManager/Login"
rsp = s.post(url, json = Body1, auth=("1002","0123"))
print (rsp.status_code)
cookie = rsp.cookies
url ="http://"+edge_server+":7780/xtvschedule/rest//ContentManager/BrowseRecordedAssets"
rsp = s.get(url,cookies=cookie)
print(rsp.status_code)
print(rsp.content)
谢谢您的帮助!