MCPcopy
hub / github.com/scrapy/scrapy / _get_agent

Method _get_agent

scrapy/core/downloader/handlers/http2.py:83–96  ·  view source on GitHub ↗
(self, request: Request, timeout: float | None)

Source from the content-addressed store, hash-verified

81 self._crawler = crawler
82
83 def _get_agent(self, request: Request, timeout: float | None) -> H2Agent:
84 from twisted.internet import reactor
85
86 if request.meta.get("proxy"): # pragma: no cover
87 raise NotImplementedError(f"{type(self).__name__} doesn't support proxies.")
88 bind_address = request.meta.get("bindaddress") or self._bind_address
89 bind_address = normalize_bind_address(bind_address)
90 return H2Agent(
91 reactor=reactor,
92 context_factory=self._context_factory,
93 connect_timeout=timeout,
94 bind_address=bind_address,
95 pool=self._pool,
96 )
97
98 def download_request(self, request: Request, spider: Spider) -> Deferred[Response]:
99 from twisted.internet import reactor

Callers 1

download_requestMethod · 0.95

Calls 3

normalize_bind_addressFunction · 0.90
H2AgentClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected