I am trying to use Scrapy to login Github.
# -*- coding: utf-8 -*-
import scrapy
class AutoreplySpider(scrapy.Spider):
name = 'AutoLogin'
allowed_domains = ['github.com']
start_urls = ['https://github.com/login']
def parse(self, response):
return scrapy.FormRequest.from_response(
response,
formdata={
'login': 'ac',
'password': 'pw'
},
callback=self.reply
)
def after_login(self, response):
pass
When I logged in Github manually, I checked the box like "remember username and password". So if I don't log out, it should be automatically login when I visit Github again. I ran the script in terminal and it didn't come up with any error. However, when I visit Github, it requires me to log in. I'm not sure if my code works. I didn't touch Scrapy for a while. Is there any quick way to check if I am logged in successfully? Thank you!