How to do it

The 06/01_scrapy_retry.py script demonstrates how to configure Scrapy for retries. The script file contains the following configuration for Scrapy:  

process = CrawlerProcess({    'LOG_LEVEL': 'DEBUG',    'DOWNLOADER_MIDDLEWARES':        {            "scrapy.downloadermiddlewares.retry.RetryMiddleware": 500        },    'RETRY_ENABLED': True,    'RETRY_TIMES': 3})process.crawl(Spider)process.start()

Get Python Web Scraping Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.