网页摸拟登陆,求帮助

2014-01-27 23:47:04 +08:00
 iyuyue
我知道这种问题已经很泛滥了,求轻拍。。

想要登陆这个网页: http://szvip.51dzm.com/Login.aspx

脚本修改自: http://www.v2ex.com/t/80927

headers = {
"User-Agent": UA,
"Host": "szvip.51dzm.com",
"Origin": "http://szvip.51dzm.com/",
"Referer": "http://szvip.51dzm.com/Login.aspx"
}

def mix_post_info(url):
post_info = {
"ctl00$ContentPlaceHolder1$phone": username,
"ctl00$ContentPlaceHolder1$pass": password,
"ctl00$ContentPlaceHolder1$chkPass": 'on',
"ctl00$ContentPlaceHolder1$btnLogin": '密码登录'
}
return post_info

def try_login(url):
post_info = mix_post_info(url)
resp = v2ex_session.post(url, data=post_info, headers=headers, verify=False)
if check_balance(index_url):
return True
else:
return False

通过以上方式目前无法登录,用户名密码没有问题,求帮助!
2252 次点击
所在节点    问与答
4 条回复
yangqi
2014-01-28 00:02:11 +08:00
form里还有两个hidden field
iyuyue
2014-01-28 00:11:46 +08:00
@yangqi It works! Thank you so much!
bcxx
2014-01-28 00:19:01 +08:00
下次不知道要交哪些 field 的时候可以试试登录看那个 302 的 POST 请求记录(应该都有的吧,不记得是不是 302 了- -),看 request header 带了什么就好
iyuyue
2014-01-28 00:38:28 +08:00
@bcxx 嗯嗯,看的时候直接忽略那堆乱码了= =!

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/98538

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX