scrapy获取settings配置信息

1.最笨的方法是导入配置:

from myproject.settings import MONGO_URI
from myproject.settings import MONGO_DATABASE
from myproject.settings import MONGO_COLLECTION

2.在spider里面获取settings配置:

from scrapy.conf import settings

使用方法:

driver_path = settings.get("WEBDRIVER_CHROME_PATH")
    原文作者:风一样的存在
    原文地址: https://www.jianshu.com/p/d550c238d60d
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞