MCPcopy
hub / github.com/scrapy/scrapy / _cancel

Method _cancel

scrapy/core/http2/stream.py:160–167  ·  view source on GitHub ↗
(self, _: Any)

Source from the content-addressed store, hash-verified

158 self._deferred_response: Deferred[Response] = Deferred(self._cancel)
159
160 def _cancel(self, _: Any) -> None:
161 # Close this stream as gracefully as possible
162 # If the associated request is initiated we reset this stream
163 # else we directly call close() method
164 if self.metadata["request_sent"]:
165 self.reset_stream(StreamCloseReason.CANCELLED)
166 else:
167 self.close(StreamCloseReason.CANCELLED)
168
169 def __repr__(self) -> str:
170 return f"Stream(id={self.stream_id!r})"

Callers

nothing calls this directly

Calls 2

reset_streamMethod · 0.95
closeMethod · 0.95

Tested by

no test coverage detected