MCPcopy
hub / github.com/scrapy/scrapy / connectionLost

Method connectionLost

scrapy/core/downloader/handlers/http11.py:715–739  ·  view source on GitHub ↗
(self, reason: Failure = connectionDone)

Source from the content-addressed store, hash-verified

713 )
714
715 def connectionLost(self, reason: Failure = connectionDone) -> None:
716 if self._finished.called:
717 return
718
719 if reason.check(ResponseDone):
720 self._finish_response()
721 return
722
723 if reason.check(PotentialDataLoss):
724 self._finish_response(flags=["partial"])
725 return
726
727 if reason.check(ResponseFailed) and any(
728 r.check(_DataLoss)
729 for r in reason.value.reasons # type: ignore[union-attr]
730 ):
731 if not self._fail_on_dataloss:
732 self._finish_response(flags=["dataloss"])
733 return
734
735 exc = ResponseDataLossError()
736 exc.__cause__ = reason.value
737 reason = Failure(exc)
738
739 self._finished.errback(reason)

Callers

nothing calls this directly

Calls 4

_finish_responseMethod · 0.95
checkMethod · 0.80
errbackMethod · 0.45

Tested by

no test coverage detected