scrapy passing custom_settings to spider from script using CrawlerProcess.crawl()

后端 未结 4 1551
予麋鹿
予麋鹿 2021-01-05 09:19

I am trying to programatically call a spider through a script. I an unable to override the settings through the constructor using CrawlerProcess. Let me illustrate this with

4条回答
  •  既然无缘
    2021-01-05 10:02

    It seems you want to have custom log for each spiders. You need to activate the logging like this:

    from scrapy.utils.log import configure_logging
    
    class MySpider(scrapy.Spider):
        #ommited
        def __init__(self):
            configure_logging({'LOG_FILE' : "logs/mylog.log"})
    

提交回复
热议问题