保留Cookie和与Python的会话不起作用

时间:2018-08-10 18:36:15

标签: python session cookies python-requests

我正在尝试在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)

谢谢您的帮助!

这是在soapui上正确运行的同一个api的api: 1

0 个答案:

没有答案