I want to write to the database (start_time) once the spider start and want to store all statistics that being sent by email to the database too. So how could I do that ?
Should I write middlerware, If so, how could I trigger spider start and end ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here is what I figured out, Creating my own extension as described below :
http://doc.scrapy.org/en/latest/topics/extensions.html#writing-your-own-extension
BTW, I couldn’t know where to save the file, so I tried to name it myextension.py with class MyExtension and save in my project folder. Then in settings file (settings.py) call it as follows :