Skip to content

Instantly share code, notes, and snippets.

@n3rio
Created January 11, 2019 19:35
Show Gist options
  • Select an option

  • Save n3rio/e9deb66e8053badb02728f251c13d8be to your computer and use it in GitHub Desktop.

Select an option

Save n3rio/e9deb66e8053badb02728f251c13d8be to your computer and use it in GitHub Desktop.
Autorestart spider when failed
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