MCPcopy
hub / github.com/scrapy/scrapy / download_request

Method download_request

scrapy/core/downloader/handlers/http2.py:47–62  ·  view source on GitHub ↗
(self, request: Request)

Source from the content-addressed store, hash-verified

45 self._bind_address = crawler.settings.get("DOWNLOAD_BIND_ADDRESS")
46
47 async def download_request(self, request: Request) -> Response:
48 if urlparse_cached(request).scheme == "http": # pragma: no cover
49 raise UnsupportedURLSchemeError(
50 f"{type(self).__name__} doesn't support plain HTTP."
51 )
52 agent = _ScrapyH2Agent(
53 context_factory=self._context_factory,
54 pool=self._pool,
55 bind_address=self._bind_address,
56 crawler=self._crawler,
57 )
58 assert self._crawler.spider
59 with wrap_twisted_exceptions():
60 return await maybe_deferred_to_future(
61 agent.download_request(request, self._crawler.spider)
62 )
63
64 async def close(self) -> None:
65 self._pool.close_connections()

Callers

nothing calls this directly

Calls 6

urlparse_cachedFunction · 0.90
wrap_twisted_exceptionsFunction · 0.90
maybe_deferred_to_futureFunction · 0.90
_ScrapyH2AgentClass · 0.85
download_requestMethod · 0.45

Tested by

no test coverage detected