Processes the next item or request from Spider.start(). If a request, it is scheduled. If an item, it is sent to item pipelines.
(self)
| 267 | self.paused = False |
| 268 | |
| 269 | async def _process_start_next(self) -> None: |
| 270 | """Processes the next item or request from Spider.start(). |
| 271 | |
| 272 | If a request, it is scheduled. If an item, it is sent to item |
| 273 | pipelines. |
| 274 | """ |
| 275 | assert self._start is not None |
| 276 | try: |
| 277 | item_or_request = await anext(self._start) |
| 278 | except StopAsyncIteration: |
| 279 | self._start = None |
| 280 | except Exception as exception: |
| 281 | self._start = None |
| 282 | exception_traceback = format_exc() |
| 283 | logger.error( |
| 284 | f"Error while reading start items and requests: {exception}.\n{exception_traceback}", |
| 285 | exc_info=True, |
| 286 | ) |
| 287 | else: |
| 288 | if not self.spider: |
| 289 | return # spider already closed |
| 290 | if isinstance(item_or_request, Request): |
| 291 | self.crawl(item_or_request) |
| 292 | else: |
| 293 | assert self._slot is not None |
| 294 | _schedule_coro( |
| 295 | self.scraper.start_itemproc_async(item_or_request, response=None) |
| 296 | ) |
| 297 | self._slot.nextcall.schedule() |
| 298 | |
| 299 | async def _start_request_processing(self) -> None: |
| 300 | """Starts consuming Spider.start() output and sending scheduled |
no test coverage detected