Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么会有';Python中的http登录响应中没有会话ID?_Python_Http_Post_Login - Fatal编程技术网

为什么会有';Python中的http登录响应中没有会话ID?

为什么会有';Python中的http登录响应中没有会话ID?,python,http,post,login,Python,Http,Post,Login,我的服务器成功地用cookie头响应我的浏览器客户端。但是Python有一个问题。我没有看到任何会话ID为的cookie头 我的代码: import requests url = 'http://192.168.0.100/login' values = {'email': 'dude@example.com', 'password': '2314'} with requests.session() as s: s.get(url) r = s.post(

我的服务器成功地用cookie头响应我的浏览器客户端。但是Python有一个问题。我没有看到任何会话ID为的cookie头

我的代码:

import requests

url = 'http://192.168.0.100/login'
values = {'email': 'dude@example.com',
          'password': '2314'}

with requests.session() as s:
    s.get(url)
    r = s.post(url, data=values)
    print(r.headers)`

在身份验证之后,您似乎确实在服务器上重定向了,而客户端没有得到任何cookie头。尝试包括对请求的重定向限制:

r = s.post(url, data=values, allow_redirects=False)
然后通过以下方式访问任何cookie头:

r.cookies['HEADER\u NAME']