Lazy-load the downloadhandler for a scheme only on the first request for that scheme.
(self, scheme: str)
| 70 | crawler.signals.connect(self._close, signals.engine_stopped) |
| 71 | |
| 72 | def _get_handler(self, scheme: str) -> DownloadHandlerProtocol | None: |
| 73 | """Lazy-load the downloadhandler for a scheme |
| 74 | only on the first request for that scheme. |
| 75 | """ |
| 76 | if scheme in self._handlers: |
| 77 | return self._handlers[scheme] |
| 78 | if scheme in self._notconfigured: |
| 79 | return None |
| 80 | if scheme not in self._schemes: |
| 81 | self._notconfigured[scheme] = "no handler available for that scheme" |
| 82 | return None |
| 83 | |
| 84 | return self._load_handler(scheme) |
| 85 | |
| 86 | def _load_handler( |
| 87 | self, scheme: str, skip_lazy: bool = False |