问题
Based on Scrapy : Program organization when interacting with secondary website , I have:
class MyPipeline(object):
def __init__(self, crawler):
self.crawler = crawler
I'm trying to get a better understanding of the code especially the lines at the beginning listed above. Why would you initialize the pipeline object with a crawler. I have a lot of pipelines where I don't include this or any init method. What is the purpose of initializing the pipeline with a crawler?
来源:https://stackoverflow.com/questions/42515747/initializing-pipeline-object-with-crawler-in-scrapy