python - 爬虫之模拟登入问题
PHP中文网
PHP中文网 2017-04-17 17:28:00
0
3
696

在模拟登入极客学院时候,有个验证码,验证码链接后面带一个参数,琢磨不透这个参数怎么来的
类似这个验证码链接
http://passport.jikexueyuan.com/sso/verify?1459004256917
后面的一个参数1459004256917,这个是根据什么算出来的还是从哪里匹配下来的?

代码补充:

def startLogin(self): verify_img = r'http://passport.jikexueyuan.com/sso/verify?%s' %(time.time()) print verify_img verify = raw_input('输入验证码:') login_data = { 'expire':'7', 'referer':'http://www.jikexueyuan.com/', 'uname':self.username, 'password':self.password, 'verify':verify } s_login = login_session.post(self.loginurl,data=login_data,headers=headers) print type(s_login.json()) for k,v in s_login.json().items(): print k,v

最后执行的时候,得到的信息结果:

http://passport.jikexueyuan.com/sso/verify?1459164531.42 输入验证码:1857  status 0 msg 验证码错误 jumpUrl /sso/login

老是提示验证码错误

PHP中文网
PHP中文网

认证0级讲师

reply all (3)
巴扎黑

When submitting the URL, just use time.time() directly.

import time url = 'http://passport.jikexueyuan.com/sso/verify?%s'%(time.time())
    阿神

    Time stamp only

    The number of milliseconds from now to 1970.1.1

      迷茫

      Just write fixed, just to prevent caching.

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!