Scrapy Settings Import paths and classes

时间:2021-09-04 04:13:19   收藏:0   阅读:29

Scrapy 配置

New in version 2.4.0.
When a setting references a callable object to be imported by Scrapy, such as a > class or a function, there are two different ways you can specify that object:

  • As a string containing the import path of that object
  • As the object itself

2.4.0版本之后,scrapy支持两种配置方式

from mybot.pipelines.validate import ValidateMyItem
ITEM_PIPELINES = {
    # passing the classname...
    ValidateMyItem: 300,
    # ...equals passing the class path
    ‘mybot.pipelines.validate.ValidateMyItem‘: 300,
}

更多内容参见: Scrapy Settings

原文:https://www.cnblogs.com/rain-chenwei/p/15223147.html

评论(0)
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!