suppress Scrapy Item printed in logs after pipeline

后端 未结 8 630
无人及你
无人及你 2020-12-25 12:43

I have a scrapy project where the item that ultimately enters my pipeline is relatively large and stores lots of metadata and content. Everything is working properly in my s

8条回答
  •  渐次进展
    2020-12-25 13:09

    We use the following sample in production:

    import logging
    
    logging.getLogger('scrapy.core.scraper').addFilter(
        lambda x: not x.getMessage().startswith('Scraped from'))
    

    This is a very simple and working code. We add this code in __init__.py in module with spiders. In this case this code automatically run with command like scrapy crawl for all spiders.

提交回复
热议问题