I have created a spider which inherits from CrawlSpider.
I need to use the __init__ function but always getting this error:
code:
class mySpider(CrawlSpider):
def __init__(self):
super(mySpider, self).__init__()
.....
this is the error I’m getting:
KeyError Spider not found: mySpider.
without the __init__ function everything works
You need to put it like this:
Working example:
Here init was used to register scrapy signals in spider, I needed it in this example in spider instead of usually in pipeline