facebook - Scrapy FormRequest from response AtrributeError: 'str' object has no attribute 'encoding' -


i trying login facebook using scrapy.

i have identified mobile version of facebook works without javascript, using it.

the relevant code is

from loginform import fill_login_form scrapy.http import formrequest  def parse(self, response):     """login facebook pass on"""     payload = fill_login_form(         response.request.url,  # https://m.facebook.com         response.body,         self.login_user,         self.login_pass     )     return formrequest.from_response(         response.request.url,         formdata=payload,         formid='login-form',         callback=self.after_login     ) 

the error is:

file "/xxx/scraps/scraps/spiders/fb.py", line 44, in parse     return formrequest.from_response(response.request.url, formdata=payload, formid='login-form', callback=self.after_login)   file "/xxx/venv/lib/python3.6/site-packages/scrapy/http/request/form.py", line 42, in from_response     kwargs.setdefault('encoding', response.encoding) attributeerror: 'str' object has no attribute 'encoding' 

scrapy on default settings.

i want spider login m.facebook.com. i'm pretty sure weak google-fu, not able determine, how move forward.

the from_response method requires first argument response object not url, please check docs, there's example uses formrequest.from_response simulate user login.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -