V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Vicer
V2EX  ›  问与答

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

  •  
  •   Vicer · 2015-10-19 21:56:58 +08:00 · 1617 次点击
    这是一个创建于 3127 天前的主题,其中的信息可能已经有所发展或是发生改变。

    部分代码如下:

    登陆

    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 就不能签到成功?
    请问什么该怎么修改?

    3 条回复    2015-10-19 22:38:51 +08:00
    Septembers
        1
    Septembers  
       2015-10-19 22:28:10 +08:00 via iPad
    这不是 python 的问题

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

    BTW, requests 大法好,不要用 urllib 了。目前用到 urllib 的地方只有用于下载图片
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2683 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 05:58 · PVG 13:58 · LAX 22:58 · JFK 01:58
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.