没有Cookie响应urllib2有效凭据

时间:2016-09-06 19:43:54

标签: python urllib2

您好我正在开发一个针对logmein网站的应用程序,我很肯定我发送与我的Firefox浏览器完全相同的数据(使用实时HTTP标题测试等)。

import urllib2

header = {
'User-Agent': 'HIDDEN',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'en-GB,en;q=0.5',
'Referer': 'https://accounts.logme.in/login.aspx',
'Host': 'accounts.logme.in',
'Cookie': 'csrftoken=HIDDEN',
'Connection': 'keep-alive',
'Upgrade-Insecure-Requests': '1',
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': '182'
}

data ='csrftoken=HIDDEN&__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE=&email=HIDDEN%40hotmail.com&hiddenEmail=&password=HIDDEN'

print urllib2.urlopen(urllib2.Request('https://accounts.logme.in/auth.aspx', data, header)).info()

响应 (resp.info()):

Cache-Control: no-cache, no-store
Pragma: no-cache
Content-Type: text/html; charset=utf-8
Expires: -1
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-UA-Compatible: IE=edge
X-Frame-Options: SAMEORIGIN
Vary: Accept-Encoding
Date: Tue, 06 Sep 2016 19:24:07 GMT
Content-Length: 10579
Connection: close

正如您所看到的,响应标头中没有cookie

0 个答案:

没有答案