MCPcopy
hub / github.com/scrapy/scrapy / parse_rows

Method parse_rows

scrapy/spiders/feed.py:142–153  ·  view source on GitHub ↗

Receives a response and a dict (representing each row) with a key for each provided (or detected) header of the CSV file. This spider also gives the opportunity to override adapt_response and process_results methods for pre and post-processing purposes.

(self, response: Response)

Source from the content-addressed store, hash-verified

140 raise NotImplementedError
141
142 def parse_rows(self, response: Response) -> Any:
143 """Receives a response and a dict (representing each row) with a key for
144 each provided (or detected) header of the CSV file. This spider also
145 gives the opportunity to override adapt_response and
146 process_results methods for pre and post-processing purposes.
147 """
148
149 for row in csviter(
150 response, self.delimiter, self.headers, quotechar=self.quotechar
151 ):
152 ret = iterate_spider_output(self.parse_row(response, row))
153 yield from self.process_results(response, ret)
154
155 def _parse(self, response: Response, **kwargs: Any) -> Any:
156 if not hasattr(self, "parse_row"):

Callers 2

_parseMethod · 0.95
test_parse_rowsMethod · 0.80

Calls 4

parse_rowMethod · 0.95
process_resultsMethod · 0.95
csviterFunction · 0.90
iterate_spider_outputFunction · 0.90

Tested by 1

test_parse_rowsMethod · 0.64