def after_initial_csrf(self, response):
login_url = (<EOL>URLObject("<STR_LIT>")<EOL>.with_hostname(self.domain)<EOL>.with_port(self.port)<EOL>.with_path(LOGIN_API_PATH)<EOL>)<EOL>credentials = {<EOL>"<STR_LIT:email>": self.login_email,<EOL>"<STR_LIT:password>": self.login_password,<EOL>}<EOL>headers = {<EOL>b"<STR_LIT>": get_csrf_token(response),<EOL>}<EOL>yield scrapy.FormRequest(<EOL>login_url,<EOL>formdata=credentials,<EOL>headers=headers,<EOL>callback=self.after_initial_login,<EOL>errback=self.handle_error<EOL>)<EOL>
This method is called *only* if the crawler is started with an
email and password combination.
In order to log in, we need a CSRF token from a GET request. This
method takes the result of a GET request, extracts the CSRF token,
and uses it to make a login request. The response to this login
request will be handled by the `after_initial_login` method.