Exemplo n.º 1
0
    def login(self, response):
        open_in_browser(response)
        file = open(response.html, 'w')
        file.write(response)
        file.close()
        
        # 下载验证码
        image_urls = 'https://upassport.lianjia.com/freshCaptch'
        yield {'image_urls': [image_urls]}

        formdata = {
            'user': self.user,
            'password' : self.password,
            'code': self.get_captcha_by_OCR(images.path)
        }
        
        yield FormRequest.form_response(login_response, callback=self.parse_login,formdata=formdata, dont_filter=True)