Example #1
0
 def post_requests(self, response):
     serverdata = re.findall('{"retcode":0,"servertime":(.*?),"pcid":.*?,"nonce":"(.*?)","pubkey":"(.*?)","rsakv":"(.*?)","is_openlock":.*,"exectime":.*}',response.body,re.I)[0] #获取get请求的数据,用于post请求登录
     servertime = serverdata[0]
     nonce = serverdata[1]
     pubkey = serverdata[2]
     rsakv = serverdata[3]
     username = self.start_username
     password = self.start_password
     formdata = {
         'entry': 'weibo',
         'gateway': '1',
         'from': '',
         'ssosimplelogin': '******',
         'vsnf': '1',
         'vsnval': '',
         'su': getinfo.get_user(username),
         'service': 'miniblog',
         'servertime': servertime,
         'nonce': nonce,
         'pwencode': 'rsa2',
         'sp': getinfo.get_pwd(password,servertime,nonce,pubkey),
         'encoding': 'UTF-8',
         'prelt': '115',
         'rsakv': rsakv,
         'url': 'http://weibo.com/ajaxlogin.php?framelogin=1&callback=parent.sinaSSOController.feedBackUrlCallBack',
         'returntype': 'META'
         }
     headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20100101 Firefox/8.0 Chrome/20.0.1132.57 Safari/536.11'}
     return [FormRequest(url='http://login.sina.com.cn/sso/login.php?client=ssologin.js(v1.4.18)', formdata=formdata, headers=headers, callback=self.get_cookie)]
Example #2
0
 def start_requests(self):
     username = self.start_username
     username = getinfo.get_user(username)
     url = 'http://login.sina.com.cn/sso/prelogin.php?entry=sso&callback=sinaSSOController.preloginCallBack&su=%s&rsakt=mod&client=ssologin.js(v1.4.18)' % username
     return [Request(url=url, method='get', callback=self.post_requests)]