MCPcopy
hub / github.com/scrapy/scrapy / _cb_timeout

Method _cb_timeout

scrapy/core/downloader/handlers/http11.py:486–495  ·  view source on GitHub ↗
(self, result: _T, request: Request, url: str, timeout: float)

Source from the content-addressed store, hash-verified

484 return d3
485
486 def _cb_timeout(self, result: _T, request: Request, url: str, timeout: float) -> _T:
487 if self._timeout_cl.active():
488 self._timeout_cl.cancel()
489 return result
490 # needed for HTTPS requests, otherwise _ResponseReader doesn't
491 # receive connectionLost()
492 if self._txresponse:
493 self._txresponse._transport.stopProducing()
494
495 raise DownloadTimeoutError(f"Getting {url} took longer than {timeout} seconds.")
496
497 def _cb_latency(self, result: _T, request: Request, start_time: float) -> _T:
498 request.meta["download_latency"] = monotonic() - start_time

Callers

nothing calls this directly

Calls 3

stopProducingMethod · 0.80
cancelMethod · 0.45

Tested by

no test coverage detected