Scrapy, a fast high-level web crawling & scraping framework for Python.
Improve error message when callback is not callable
Valdir Stumm Juniorbb0bd691d9dd
diff --git a/scrapy/http/request/__init__.py b/scrapy/http/request/__init__.pyindex b9c5f8541..13a92ffa0 100644--- a/scrapy/http/request/__init__.py+++ b/scrapy/http/request/__init__.py@@ -28,9 +28,9 @@ class Request(object_ref):self.priority = priorityif callback is not None and not callable(callback):- raise TypeError('callback must be a function, got %s' % type(callback).__name__)+ raise TypeError('callback must be a callable, got %s' % type(callback).__name__)if errback is not None and not callable(errback):- raise TypeError('errback must be a function, got %s' % type(errback).__name__)+ raise TypeError('errback must be a callable, got %s' % type(errback).__name__)assert callback or not errback, "Cannot use errback without a callback"self.callback = callbackself.errback = errback