Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. def login(self, response):
  2. """Generate a login request."""
  3. auth_msg = response.css('.title--h1::text').get()
  4. if auth_msg and auth_msg.lower() == 'identification':
  5. # We Must authenticate first !
  6. csrf_token = response.css('#user_csrf_token').xpath('@value').get()
  7. data = {
  8. 'action':'signin',
  9. 'user_csrf_token':csrf_token,
  10. 'user_username':login_informations.get('username'),
  11. 'user_password':login_informations.get('password')
  12. }
  13.  
  14. return scrapy.FormRequest(url=self.login_url, formdata=data, callback=self.check_login_response)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement