Scrapy, a fast high-level web crawling & scraping framework for Python.
Deprecate HTTP/1.0 support.
Andrey Rakhmatullind27c6b46b11c
diff --git a/scrapy/core/downloader/handlers/http10.py b/scrapy/core/downloader/handlers/http10.pyindex 58f7ad577..0fbe5fc23 100644--- a/scrapy/core/downloader/handlers/http10.py+++ b/scrapy/core/downloader/handlers/http10.py@@ -2,8 +2,10 @@from __future__ import annotations+import warningsfrom typing import TYPE_CHECKING+from scrapy.exceptions import ScrapyDeprecationWarningfrom scrapy.utils.misc import build_from_crawler, load_objectfrom scrapy.utils.python import to_unicode@@ -26,6 +28,11 @@ class HTTP10DownloadHandler:lazy = Falsedef __init__(self, settings: BaseSettings, crawler: Crawler):+ warnings.warn(+ "HTTP10DownloadHandler is deprecated and will be removed in a future Scrapy version.",+ category=ScrapyDeprecationWarning,+ stacklevel=2,+ )self.HTTPClientFactory: type[ScrapyHTTPClientFactory] = load_object(settings["DOWNLOADER_HTTPCLIENTFACTORY"])diff --git a/scrapy/core/downloader/webclient.py b/scrapy/core/downloader/webclient.pyindex ee10ae73b..aaaf68152 100644--- a/scrapy/core/downloader/webclient.py+++ b/scrapy/core/downloader/webclient.py@@ -1,6 +1,7 @@from __future__ import annotationsimport re+import warningsfrom time import timefrom typing import TYPE_CHECKINGfrom urllib.parse import ParseResult, urldefrag, urlparse, urlunparse@@ -9,6 +10,7 @@ from twisted.internet import deferfrom twisted.internet.protocol import ClientFactoryfrom twisted.web.http import HTTPClient+from scrapy.exceptions import ScrapyDeprecationWarningfrom scrapy.http import Headers, Responsefrom scrapy.responsetypes import responsetypesfrom scrapy.utils.httpobj import urlparse_cached@@ -49,6 +51,14 @@ def _parse(url: str) -> tuple[bytes, bytes, bytes, int, bytes]:class ScrapyHTTPPageGetter(HTTPClient):delimiter = b"\n"+ def __init__(self):+ warnings.warn(+ "ScrapyHTTPPageGetter is deprecated and will be removed in a future Scrapy version.",+ category=ScrapyDeprecationWarning,+ stacklevel=2,+ )+ super().__init__()+def connectionMade(self):self.headers = Headers() # bucket for response headers@@ -140,6 +150,12 @@ class ScrapyHTTPClientFactory(ClientFactory):self.path = self.urldef __init__(self, request: Request, timeout: float = 180):+ warnings.warn(+ "ScrapyHTTPClientFactory is deprecated and will be removed in a future Scrapy version.",+ category=ScrapyDeprecationWarning,+ stacklevel=2,+ )+self._url: str = urldefrag(request.url)[0]# converting to bytes to comply to Twisted interfaceself.url: bytes = to_bytes(self._url, encoding="ascii")