Scrapy Login Authentication
Clash Royale CLAN TAG #URR8PPP Scrapy Login Authentication I am fairly new to scraping, and I have a page I would like to login to so that I can scrape. From the Scrapy documentation, it appears we should use FormRequest. Here is the example that is given in the documentation: import scrapy class LoginSpider(scrapy.Spider): name = 'example.com' start_urls = ['http://www.example.com/users/login.php'] def parse(self, response): return scrapy.FormRequest.from_response( response, formdata={'username': 'john', 'password': 'secret'}, callback=self.after_login ) def after_login(self, response): # check login succeed before going on if "authentication failed" in response.body: self.logger.error("Login failed") return # continue scraping with authenticated session... However, this seems oversimplified in most case...