mirror of
https://github.com/scrapy/scrapy.git
synced 2025-02-25 04:43:51 +00:00
fix parse command issue with callback as a string
This commit is contained in:
parent
60727dedf6
commit
0f6f486769
@ -142,7 +142,8 @@ class Command(ScrapyCommand):
|
||||
logger.error('Unable to find spider for: %(url)s',
|
||||
{'url': url})
|
||||
|
||||
request = Request(url, opts.callback)
|
||||
# Request requires callback argument as callable or None, not string
|
||||
request = Request(url, None)
|
||||
_start_requests = lambda s: [self.prepare_request(s, request, opts)]
|
||||
self.spidercls.start_requests = _start_requests
|
||||
|
||||
@ -164,7 +165,9 @@ class Command(ScrapyCommand):
|
||||
# determine real callback
|
||||
cb = response.meta['_callback']
|
||||
if not cb:
|
||||
if opts.rules and self.first_response == response:
|
||||
if opts.callback:
|
||||
cb = opts.callback
|
||||
elif opts.rules and self.first_response == response:
|
||||
cb = self.get_callback_from_rules(spider, response)
|
||||
|
||||
if not cb:
|
||||
|
Loading…
x
Reference in New Issue
Block a user