MCPcopy
hub / github.com/scrapy/scrapy / callback

Method callback

scrapy/commands/parse.py:343–356  ·  view source on GitHub ↗
(response: Response, **cb_kwargs: Any)

Source from the content-addressed store, hash-verified

341 self, spider: Spider, request: Request, opts: argparse.Namespace
342 ) -> Request:
343 def callback(response: Response, **cb_kwargs: Any) -> Deferred[list[Any]]:
344 # memorize first request
345 if not self.first_response:
346 self.first_response = response
347
348 cb = self._get_callback(spider=spider, opts=opts, response=response)
349
350 # parse items and requests
351 depth: int = response.meta["_depth"]
352
353 d = self.run_callback(response, cb, cb_kwargs)
354 d.addCallback(self._get_items_and_requests, opts, depth, spider, callback)
355 d.addCallback(self.scraped_data)
356 return d
357
358 # update request meta if any extra meta was passed through the --meta/-m opts.
359 if opts.meta:

Callers 15

handleMethod · 0.80
_callbackMethod · 0.80
_errbackMethod · 0.80
process_chainFunction · 0.80
_check_if_closingMethod · 0.80
_wait_for_processingMethod · 0.80
_maybe_fire_closingMethod · 0.80
stop_asyncMethod · 0.80
_wait_for_downloadMethod · 0.80
processProxyResponseMethod · 0.80
_finish_responseMethod · 0.80

Calls 2

_get_callbackMethod · 0.95
run_callbackMethod · 0.95

Tested by 14

cbMethod · 0.64
process_requestMethod · 0.64
test_deferredMethod · 0.64
test_deferredMethod · 0.64
test_cb_kwargsMethod · 0.64
test_metaMethod · 0.64
test_returnsMethod · 0.64
test_returns_asyncMethod · 0.64
test_scrapesMethod · 0.64
test_regexMethod · 0.64