我正在尝试登录使用Google凭据的网站。这在我的scrapy蜘蛛中失败了:
def parse(self, response):
return scrapy.FormRequest.from_response(
response,
formdata={'email': self.var.user, 'password': self.var.password},
callback=self.after_login)
任何提示?
答案 0 :(得分:1)
经过进一步检查,我设法解决了这个,似乎是一个简单的问题:
Email
和Passwd
,按此顺序排列。有效的代码如下:
def parse(self, response): """ Insert the email. Next, go to the password page. """ return scrapy.FormRequest.from_response( response, formdata={'Email': self.var.user}, callback=self.log_password) def log_password(self, response): """ Enter the password to complete the log in. """ return scrapy.FormRequest.from_response( response, formdata={'Passwd': self.var.password}, callback=self.after_login)