Initializing pipeline object with crawler in scrapy

社会主义新天地 提交于 2019-12-20 04:11:10

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!