Cookie有选择地不与请求一起发送

时间:2017-11-29 20:25:01

标签: python python-3.x cookies python-requests fiddler

在Python 3.6中使用requests模块(也与3.5一起使用),这是我的代码的本质:

sess=requests.Session()
login_to_stackexchange(sess) # logs in to SE
print(sess.cookies) # see below
sess.post("chat.stackexchange.com/something",data=data) # data={"index":stuff}

第3行的cookies是:

<Cookie acct=t=[key here]&s=[key here] for .stackexchange.com/>
<Cookie prov=[key here] for .stackexchange.com/>

但是,当使用Fiddler查看发送的请求时,仅发送第一个cookie(prov)。我需要两个cookie来满足我的工作要求。

为什么请求只发送一个cookie? 我该如何解决这个问题?

&#34;全&#34;第3行返回的cookie:

<Cookie uauth=true for .chemistry.stackexchange.com/>
<Cookie acct=t=[key here]&s=[key here] for .stackexchange.com/>
<Cookie prov=[key here] for .stackexchange.com/>
<Cookie sechatusr=t=[key here] for chat.stackexchange.com/>
<Cookie anon=[key here] for openid.stackexchange.com/>

0 个答案:

没有答案
相关问题