MCPcopy
hub / github.com/scrapy/scrapy / _close

Method _close

scrapy/core/downloader/handlers/__init__.py:158–178  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

156 return await handler.download_request(request)
157
158 async def _close(self) -> None:
159 for dh in self._handlers.values():
160 if not hasattr(dh, "close"): # pragma: no cover
161 warnings.warn(
162 f"{global_object_name(dh)} doesn't define a close() method."
163 f" This is deprecated, please add an empty 'async def close()' method.",
164 category=ScrapyDeprecationWarning,
165 stacklevel=1,
166 )
167 continue
168
169 if inspect.iscoroutinefunction(dh.close):
170 await dh.close()
171 else: # pragma: no cover
172 warnings.warn(
173 f"{global_object_name(dh.close)} is not a coroutine function."
174 f" This is deprecated, please rewrite it to return a coroutine.",
175 category=ScrapyDeprecationWarning,
176 stacklevel=1,
177 )
178 await ensure_awaitable(dh.close())

Callers

nothing calls this directly

Calls 4

global_object_nameFunction · 0.90
ensure_awaitableFunction · 0.90
valuesMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected