@
109109 谢谢~因为我用的是httplib2,它的example这么写的:
At this point, our "response" variable contains a dictionary of HTTP header fields that were returned by the server. If a cookie was returned, you would see a "set-cookie" field containing the cookie value. We want to take this value and put it into the outgoing HTTP header for our subsequent requests:
headers['Cookie'] = response['set-cookie']
Now we can send a request using this header and it will contain the cookie, so the server can recognize us.
经过多次尝试发现,response获得的set-cookie如下:
'set-cookie': 'ac7a01853674b6a123603b654daa46ae__typecho_uid=1; path=/, ac7a01853674b6a123603b654daa46ae__typecho_authCode=%24T%24hXP2M1zQKe39302496417bc276ae46f0c737fdce7; path=/'
然后我就直接把set-cookie的内容给发了过去,也就是带" path=/",嗯……没错,我就这么发过去的,因为example都这么写的啊……
经过半天的折腾,把" path=/"去掉就正常了。
深深的感觉到了来自世界的恶意啊……
虽然从原理上来讲httplib2这么处理是没错的,但是example能靠谱点么= =||
urllib2对cookies是自动处理的,所以不存在这个问题。