Created
January 11, 2019 19:35
-
-
Save n3rio/e9deb66e8053badb02728f251c13d8be to your computer and use it in GitHub Desktop.
Autorestart spider when failed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def handle_error(self, failure): | |
| self.log("Error Handle: %s" % failure.request) | |
| self.log("Sleeping 60 seconds") | |
| time.sleep(60) | |
| url = 'http://www.google.com' | |
| yield scrapy.Request(url, self.parse, errback=self.handle_error, dont_filter=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment