在模拟登入极客学院时候,有个验证码,验证码链接后面带一个参数,琢磨不透这个参数怎么来的
类似这个验证码链接
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
老是提示验证码错误
When submitting the URL, just use time.time() directly.
Time stamp only
The number of milliseconds from now to 1970.1.1
Just write fixed, just to prevent caching.