Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
fix BaseHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
tunstek committed Nov 6, 2019
1 parent 94f9d7a commit f80250d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pyspider/libs/base_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,14 @@ def _crawl(self, url, **kwargs):

if kwargs.get('callback'):
callback = kwargs['callback']
print("HERE")
if isinstance(callback, six.string_types) and hasattr(self, callback):
func = getattr(self, callback)
elif six.callable(callback) and hasattr(self, callback.__name__):
print("HERE2")
func = getattr(self, callback)
elif six.callable(callback) and six.get_method_self(callback) is self:
func = callback
kwargs['callback'] = func.__name__
elif six.callable(callback) and hasattr(self, callback.__name__):
func = getattr(self, callback)
kwargs['callback'] = func.__name__
else:
raise NotImplementedError("self.%s() not implemented!" % callback)
if hasattr(func, '_config'):
Expand Down

0 comments on commit f80250d

Please sign in to comment.