小白请教一个关于 Python 的问题。

2015-10-19 21:56:58 +08:00
 Vicer

部分代码如下:

登陆

url = 'https://bbs.tianshi2.com/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&inajax=1';
postData = urllib.urlencode({'username': self.userName, 'password': self.password, 'answer': '', 'cookietime': '2592000', 'handlekey': 'ls', 'questionid': '0', 'quickforward': 'yes',  'fastloginfield': 'username'})
req = urllib2.Request(url,postData)

签到

url = 'https://bbs.tianshi2.com/plugin.php?id=dsu_paulsign:sign&operation=sign&infloat=1&inajax=1'
postData = urllib.urlencode({'fastreply': '1', 'formhash': self.formhash, 'qdxq': self.qdxq, 'todaysay': msg.encode('gbk')})
req = urllib2.Request(url,postData)

只是部分代码,上面这部分代码给 www.gn00.com 就可以签到成功!
为什么给 bbs.tianshi2.com 就不能签到成功?
请问什么该怎么修改?

1628 次点击
所在节点    问与答
3 条回复
Septembers
2015-10-19 22:28:10 +08:00
这不是 python 的问题

或许站长魔改过
Vicer
2015-10-19 22:34:35 +08:00
@Septembers 那能不能帮写个?
Kilerd
2015-10-19 22:38:51 +08:00
自己抓包,然后就可以写啦。

BTW, requests 大法好,不要用 urllib 了。目前用到 urllib 的地方只有用于下载图片

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

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

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

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

© 2021 V2EX