美文网首页
itempipeline调用setting里的属性

itempipeline调用setting里的属性

作者: ygquincy | 来源:发表于2018-08-09 21:11 被阅读0次

1. 

from scrapy.utils.project import get_project_settings

attr = get_project_settings().get('attr')

2.

from scarpy.conf import settings

3.

@classmethod

def from_crawler(cls, crawler):

    return cls(

       attr = crawler.settings.get('attr')

)

相关文章

网友评论

      本文标题:itempipeline调用setting里的属性

      本文链接:https://www.haomeiwen.com/subject/ftxhbftx.html