def check_error(self): # Stop spider if error has been raised in pipeline if hasattr(self, 'close_error'): raise CloseSpider(self.close_error)