Release notes

Scrapy 2.20.0 (2026-11-06)

Highlights:

  • Web-browser-like detection of response encodings, base URLs and meta refresh redirects, powered by frostwork

  • Requests can be awaited to get their response

  • Non-asyncio Twisted reactors are deprecated

Security bug fixes

  • Scrapy now limits by default the memory that responses can take, fixing CVE-2017-14158.

    In previous Scrapy versions, the only limit on the total size of responses in memory, SCRAPER_SLOT_MAX_ACTIVE_SIZE, covered responses waiting for or going through spider callbacks. Responses to other requests, like those of media pipelines, had no limit. For example, when media pipelines downloaded files faster than they could store them, e.g. to Amazon S3, the downloaded files piled up in memory, so a crawled website could make Scrapy run out of memory.

    The new RESPONSE_MAX_ACTIVE_SIZE setting replaces SCRAPER_SLOT_MAX_ACTIVE_SIZE and covers all responses in memory, including those to awaited requests and to requests sent with ExecutionEngine.download_async(). Use it to change or disable the limit. The shell disables it.

    (#482, #4583, #6430, #8417, #8459, #8460)

  • HttpCompressionMiddleware now decodes at most 1 content coding per response by default, and drops responses that apply more with IgnoreRequest.

    In previous Scrapy versions, the number of content codings was unlimited, so a malicious server could send a response with a Content-Encoding header that chains thousands of codings (e.g. gzip, gzip, gzip, …) to make Scrapy run as many decompression passes, causing high CPU and memory usage. See the j72p-v7rm-cwm3 security advisory for details.

    To allow more content codings per response, set the new COMPRESSION_MAX_ENCODINGS setting.

  • When http_auth_domain is not set, the credentials from http_user and http_pass are now only sent to the origin (scheme, host and port) of the request where they were first used.

    In previous Scrapy versions, they were sent to any URL, so after a cross-origin redirect, HttpAuthMiddleware added them again to the Authorization header that RedirectMiddleware had removed, sending them to the redirect target. A website could redirect Scrapy to a host under its control to steal those credentials. See the 466x-p45j-m4fx security advisory for details.

    (#8329)

  • When using a proxy from the http_proxy or https_proxy environment variables, redirects now honor the no_proxy environment variable.

    In previous Scrapy versions, a redirect to a URL with the same scheme kept the proxy of the original request, even if the redirect host matched no_proxy. A website could redirect Scrapy to an internal host, and that request would be sent through the proxy. For http:// URLs, this exposed the request to the proxy, including any cookies or credentials for that host, and allowed the proxy to forge the response. See the x3px-j3qh-fp5w security advisory for details.

  • S3FilesStore now uses HTTPS with the default Scrapy settings.

    In previous Scrapy versions, the default value of AWS_USE_SSL, None, was incorrectly interpreted to mean “disable HTTPS”, so S3FilesStore used plain HTTP when talking to S3 unless that setting was explicitly set to True or AWS_ENDPOINT_URL was set to a custom HTTPS URL.

    An attacker who could observe that traffic could read the contents, S3 paths and metadata of the files uploaded by FilesPipeline and ImagesPipeline, the AWS access key ID (but not the secret access key) and, with temporary credentials, the session token (X-Amz-Security-Token). An attacker who could tamper with that traffic could make Scrapy falsely think that a file is up to date or was successfully stored. See the fwm7-29m4-rrj9 security advisory for details.

    To restore the previous behavior, set AWS_USE_SSL to False.

  • LxmlLinkExtractor and SitemapSpider now only follow http:// and https:// URLs by default, plus URLs that use the scheme of the response they come from.

    In previous Scrapy versions, link extractors also followed file:// and ftp:// URLs, and SitemapSpider followed URLs of any scheme. A crawled website could use that to make Scrapy read local files, send the FTP_USER and FTP_PASSWORD credentials to an FTP server of its choosing, or send requests signed with the AWS_ACCESS_KEY_ID credentials to an S3 bucket of its choosing. See the q7wc-mr9r-gcjh security advisory for details.

    To follow URLs with other schemes, use the new schemes parameter of LxmlLinkExtractor or the new sitemap_schemes attribute of SitemapSpider.

Modified requirements

Backward-incompatible changes

  • Changes to the fetch() shortcut of the Scrapy shell:

    • Requests are now downloaded with ExecutionEngine.download_async() instead of being passed to the scheduler. As a result, spider middlewares and duplicate filtering are no longer applied to them.

    • When a Request object is passed, its callback and errback are no longer called, and a warning is issued if they are set.

    • The engine is no longer started, so the engine_started and engine_stopped signals are not sent, and components that start on them, such as the MemoryUsage extension and the telnet console, do not run in the shell.

    (#8174, #8176, #8179)

  • Changes to the behavior of ExecutionEngine methods that change its state:

    (#6916, #8217, #8272, #8319)

  • Setting the ExecutionEngine.running attribute no longer has any effect, and is deprecated. Its value is now False while the spider is closing. (#8181)

  • FTPDownloadHandler now enforces DOWNLOAD_MAXSIZE and DOWNLOAD_WARNSIZE, also when using ftp_local_filename, so downloads bigger than 1 GiB now fail by default. To download bigger files, raise the limit to a size that fits them, with DOWNLOAD_MAXSIZE or with the download_maxsize request meta key for specific requests. You can also set the limit to 0 to lift it altogether. (#8213)

  • The built-in HTTP download handlers now limit their open connections with the new CONCURRENT_CONNECTIONS_PER_HANDLER setting, whose default value is derived from the limit of open files of the process, or is 480 on Windows. HTTP11DownloadHandler and H2DownloadHandler had no such limit before, and AiohttpDownloadHandler and HttpxDownloadHandler used CONCURRENT_REQUESTS as their limit. If you set CONCURRENT_REQUESTS higher than that default, a warning is logged, and you need to set CONCURRENT_CONNECTIONS_PER_HANDLER or, on platforms other than Windows, raise the limit of open files of the process (see I get too many file descriptors in select() or Too many open files). (#2653, #5024, #5618, #7932)

  • HttpxDownloadHandler no longer falls back to the httpx package when httpx2 is not installed. Install the httpx extra to use it. (#7932)

  • Responses that your code keeps in memory, e.g. in the Request.meta of scheduled requests or in component attributes, now count toward RESPONSE_MAX_ACTIVE_SIZE until they are released, and so do responses in a reference cycle until Python’s garbage collector frees them. Keeping many responses can now slow down your crawl. To find out whether your crawl keeps responses alive, see Debugging memory leaks.

    If requests have been held back by the limit for 5 seconds with none being downloaded and no response released, Scrapy runs Python’s garbage collector and, if that releases no response, lets one request through, logging a warning the first time and increasing the new response_max_active_size/bypass_count stat.

    Scrapy itself no longer keeps responses alive in reference cycles after a request fails, e.g. with an HttpError that no errback handles, or after a failed media pipeline download.

    (#6430, #8417, #8459, #8460)

  • Header names in Headers objects, i.e. in Request.headers and Response.headers, now keep the case they are first set with, instead of being converted to Title-Case. Lookups are still case-insensitive, but code that iterates over header names and compares them to Title-Case strings must be updated.

    Over HTTP/1.1, AiohttpDownloadHandler and HttpxDownloadHandler now send header names in the case you write them in, and keep the case of response header names as received. See the comparison of download handlers.

    (#2711, #7893, #8265)

  • get_retry_request(), and hence RetryMiddleware, now sets the new skip_dupefilter_once request meta key on retry requests instead of setting their dont_filter attribute to True. As a result, with schedulers that support that meta key, like the default one, requests derived from a retry request, e.g. redirects, are no longer exempt from duplicate filtering. (#6895, #8224)

  • Requests whose meta is copied from a downloaded request, e.g. redirects and retries, are now assigned to the download slot of their own URL domain, instead of keeping the slot of the original request. Requests whose meta is copied from a request whose download_slot request meta key you set keep that slot, so set it to keep redirects and retries in the slot of the original request. (#8337)

  • http_user and http_pass are now only sent to the origin (scheme, host and port) of the request that you set them on, so they are no longer sent after a cross-origin redirect. To send them to a different origin, set the http_auth_domain request meta key. HttpAuthMiddleware also no longer sets the Authorization header of requests whose URL scheme is neither http nor https. (#8329)

  • Keys of component priority dictionaries, such as DOWNLOADER_MIDDLEWARES, that cannot be resolved into a component, e.g. the import path of a component that no longer exists, now raise ValueError, even if their priority is None. Some of them used to be silently ignored, and a missing module used to raise ModuleNotFoundError instead. Fix the import path or remove the entry. (#7820, #8159)

  • HttpCompressionMiddleware now raises DecompressionError for a response body that cannot be decompressed, instead of the exception of the underlying decompression library, e.g. zlib.error, OSError or EOFError. Update any code that catches those exceptions, e.g. in request errbacks. (#8177)

  • str() of a Spider object now returns its name. Use repr() to get the previous output, e.g. <MySpider 'my_spider' at 0x7f0e2c1a3b50>. (#1576, #8086)

  • The scrapy.utils.defer.parallel() and scrapy.utils.defer.parallel_async() functions, now deprecated, return a Deferred that fires with None, instead of with the result list of a DeferredList. (#5182, #7959)

  • The process_response() method of HttpCompressionMiddleware is now a coroutine function. Code that calls it must now await it, and subclasses that override it and call super().process_response() must now be async def. (#3751, #8153)

  • The item_scraped() method of scrapy.extensions.feedexport.FeedExporter, and the start_exporting() and finish_exporting() methods of scrapy.extensions.feedexport.FeedSlot, are now coroutine functions. (#5622, #6273, #7800)

  • parent_id is now part of Request.attributes, so Request.replace() and request_from_dict() pass a parent_id keyword argument to the request class. Request subclasses whose __init__() method accepts neither parent_id nor **kwargs must be updated. (#8225)

  • Item exporters now turn the values of fields without a serializer into lists if they are list-like, e.g. tuples or sets, and into dictionaries if they are items, recursively. This changes the output of PickleItemExporter, MarshalItemExporter, PprintItemExporter and custom BaseItemExporter subclasses, and CsvItemExporter now joins list-like values, e.g. sets, the way it joins lists. (#3888, #3890, #8057)

  • The output of a request errback that runs because a download failed now goes through the process_spider_output() methods of spider middlewares, with None as the response, and exceptions raised while iterating that output reach their process_spider_exception() methods. Spider middlewares whose methods expect a response must now also handle None. Built-in spider middlewares now also process that output, e.g. UrlLengthMiddleware can drop requests from such errbacks, and StartSpiderMiddleware now sets is_start_request in its process_start() method instead of in get_processed_request(). (#4999, #7992)

  • Feed storages now refuse feed modes that they do not support, which prevents the crawl from starting. In particular, setting the overwrite feed option to False for an S3 feed, which used to log a warning, now raises ValueError. For a GCS feed, which used to log a warning and overwrite the file, it now appends to the file. (#5580, #7826, #8173)

  • sitemap_follow now also filters the sitemap URLs declared in robots.txt files. If you set it, make sure it matches the URLs of the sitemaps declared in the robots.txt files that you want to follow. (#1182, #8175)

  • The process_request() method of HttpCacheMiddleware is now a coroutine function. Code that calls it must now await it, and subclasses that override it and call super().process_request() must now be async def. (#2744, #7915)

  • XMLFeedSpider.parse_nodes() and CSVFeedSpider.parse_rows() are now asynchronous generators. Code that calls them must now iterate over their output with async for. (#8392)

  • The settings of the built-in storages of media pipelines are no longer set as class attributes of those storages, e.g. S3FilesStore.POLICY keeps its default value regardless of FILES_STORE_S3_ACL. Read them from the storage object of the pipeline instead, e.g. pipeline.store.POLICY. (#7925)

  • Scraper.slot and the deprecated scrapy.core.scraper.Slot class now take a Crawler object instead of a maximum active size, their finish_response() method no longer takes a result parameter, their MIN_RESPONSE_SIZE attribute was removed, and their deprecated active_size attribute is read-only. (#6430)

  • The engine status that the telnet console reports now includes engine.response_active_size instead of engine.scraper.slot.active_size and engine.scraper.slot.needs_backout(). (#6430)

  • The deprecated METAREFRESH_IGNORE_TAGS setting and the ignore_tags parameter of the deprecated scrapy.utils.response.get_meta_refresh() function now raise ValueError for tags other than script, noscript and template, and only whether noscript is listed has any effect. METAREFRESH_IGNORE_TAGS is ignored altogether if METAREFRESH_SCRIPTING is set with the same or a higher priority. (#8393)

  • Scrapy no longer calls the deprecated spider_opened() and spider_closed() methods of SpiderState, so overriding them in a subclass has no effect. Handle the spider_state_loaded and spider_state_saving signals instead. (#5153, #7650, #7656)

  • Due to the new minimum version of w3lib, 2.6.0:

    • Request URLs are now normalized the way web browsers normalize them, so Request.url and Response.url can differ from the URL you pass, e.g. https://EXAMPLE.com becomes https://example.com/, https://example.com/a/../b becomes https://example.com/b, and https://0x7f.1/ becomes https://127.0.0.1/. Update any code that compares request or response URLs to literal strings.

    • Request fingerprints might differ for some URLs, so that cached responses of HttpCacheMiddleware and the seen requests of a job directory from an earlier version might not match the same requests.

    (#8393)

  • For encodings declared in the response, TextResponse.encoding now reports the Python codec names of the encodings that web browsers use, e.g. gbk instead of gb18030 for a gb2312 label, and utf-16-le instead of utf-16. It also reports utf-8 instead of cp1252 when the response declares no encoding and its body is ASCII-only, e.g. empty. For encoding labels that web browsers decode as a single U+FFFD character, like hz, it reports replacement, which raises UnicodeDecodeError when decoding any non-empty body, so use TextResponse.text instead of response.body.decode(response.encoding).

    TextResponse.text can also differ:

    • The detected encoding of responses that declare none and are not valid UTF-8 can change.

    • Encodings that web browsers ignore, like utf-32 or cp437, are now ignored when declared, and the encoding is detected instead. A <meta> tag or XML declaration that declares UTF-16 now means UTF-8.

    • Encoding declarations in <meta> tags are now found past the first 4096 bytes of the response body.

    • Response bodies are decoded the way web browsers decode them, which for some encodings, like euc-jp, differs from Python codecs.

    (#8393)

  • The base URL of a response, used by TextResponse.urljoin(), selectors and link extractors, and the meta refresh that MetaRefreshMiddleware follows, are now found closer to the way web browsers find them. In particular, they are now found anywhere in the response body, instead of only in its first 4096 characters, the meta refresh with the shortest delay, and the last one among those with that delay, now wins over the first one, meta refreshes within <script> or <template> elements, or to the response URL itself, ignoring its fragment, are no longer followed, and the base URL is normalized like request URLs. (#8393)

  • The response attribute of Selector objects is now read-only. For the selector of a response, i.e. TextResponse.selector, it no longer keeps the response alive, and becomes None once nothing else refers to the response. (#8245)

  • A negative value of FILES_EXPIRES or IMAGES_EXPIRES now disables expiration, so that files are never downloaded again once fetched. Previously, it made files be downloaded again every time; set the setting to 0 for that. (#8046)

  • Crawls closed because start() raised an exception, or by CLOSESPIDER_ERRORCOUNT, now make the crawl and runspider commands exit with code 1. (#8082, #8203)

  • A blank line between contract lines in a callback docstring now starts a new batch of contracts, which needs its own @url line; otherwise, the contracts of that batch do not run.

    ContractsManager.extract_contracts() now returns a list of batches, each a list of contracts, and ContractsManager.from_method() now returns a list of requests instead of a request or None.

    (#768, #8043)

Deprecations

  • The following modules are deprecated, with no replacement:

    • scrapy.utils.benchserver

    • scrapy.utils.console

    • scrapy.utils.datatypes

    • scrapy.utils.display

    • scrapy.utils.ftp

    • scrapy.utils.gz

    • scrapy.utils.job

    • scrapy.utils.ossignal

    • scrapy.utils.sitemap

    • scrapy.utils.ssl

    • scrapy.utils.template

    • scrapy.utils.versions

    (#7766, #8135, #8146, #8270)

  • The following functions, classes and methods are deprecated, with no replacement:

    • scrapy.core.scraper.Scraper.handle_spider_error()

    • scrapy.spiders.sitemap.iterloc()

    • scrapy.utils.defer.aiter_errback()

    • scrapy.utils.defer.iter_errback()

    • scrapy.utils.defer.parallel()

    • scrapy.utils.defer.parallel_async()

    • scrapy.utils.python.MutableAsyncChain

    (#8175, #8288, #8350, #8363, #8414)

  • scrapy.utils.python.garbage_collect() is deprecated, use gc.collect() instead. (#8367)

  • Passing a coroutine to scrapy.utils.spider.iterate_spider_output(), for which it returns a Deferred instead of an iterable, is deprecated. Await the coroutine and pass its result instead. (#8394)

  • Passing a synchronous iterable to scrapy.core.scraper.Scraper.handle_spider_output_async() is deprecated, pass an asynchronous iterable instead. (#8288)

  • scrapy.utils.reactor.is_asyncio_reactor_installed() is deprecated. To check for asyncio support, use is_asyncio_available(). To check whether a reactor is installed, use scrapy.utils.reactor.is_reactor_installed(). See Supporting older Scrapy versions for code that must also support older Scrapy versions. (#8128, #8454)

  • Defining a parse_item() method in a XMLFeedSpider subclass is deprecated. Define parse_node() instead. (#8147)

  • Exceptions that the process_response() method of a downloader middleware raises can now reach the process_exception() methods of the downloader middlewares that have not processed the response yet, so that RetryMiddleware can retry them. Because existing process_exception() methods may not expect those exceptions, e.g. the IgnoreRequest raised to drop a response, this only happens when the new DOWNLOADER_MIDDLEWARE_RESPONSE_EXCEPTIONS setting is True. Its default value, False, is deprecated, and a warning is issued when an exception would reach the process_exception() method of a non-Scrapy downloader middleware if the setting were True. Check that those methods handle such exceptions as intended, and set the setting to True. New projects generated with startproject already do. (#7790, #8177)

  • scrapy.utils.deprecate.create_deprecated_class() is deprecated, use formerly.deprecated_class() from formerly instead. scrapy.utils.decorators.deprecated() is deprecated, use warnings.deprecated() instead (or typing_extensions.deprecated() on Python 3.12 and lower). (#7894)

  • scrapy.utils.url.add_http_if_no_scheme() is deprecated. Use w3lib.url.add_http_if_no_scheme() instead. (#2186, #8189)

  • The following methods of Headers are deprecated:

    • fromkeys(): pass (key, value) pairs to Headers instead.

    • has_key(): use the in operator instead.

    • normkey() and normvalue().

    • setlist(): assign the list instead, e.g. headers[key] = values.

    • setlistdefault(): use setdefault() instead.

    • to_unicode_dict(): use to_tuple_list() instead.

    (#8259, #8264)

  • The spider_closed_callback parameter of ExecutionEngine is deprecated. Closing the spider now stops the engine, and Crawler.crawl_async() completes when that happens. (#6916, #8217)

  • Setting the ExecutionEngine.running attribute is deprecated, and has no effect. (#8181)

  • Custom schedulers that do not set supports_skip_dupefilter_once to True are deprecated, including subclasses of the default scheduler that override its enqueue_request() method. Scrapy turns skip_dupefilter_once into dont_filter=True for them, with a warning. To update a scheduler, handle skip_dupefilter_once in its enqueue_request() method and set supports_skip_dupefilter_once to True. (#6895, #8224)

  • The overwrite feed option is deprecated. Use the new mode feed option instead: "overwrite" instead of True, "append" instead of False. The overwrite attribute of FTPFeedStorage is deprecated as well.

    The default value of the new FEED_MODE setting, None, is also deprecated: it will change to "create" in a future version of Scrapy, so that existing feed targets are not modified. Set FEED_MODE, or the mode option of every feed, to silence the deprecation warning. New projects set FEED_MODE to "create" in their settings.py file. (#5580, #7826)

  • The STORE_SCHEMES attribute of FilesPipeline is deprecated. Use the new MEDIA_STORAGES setting instead. (#5991, #7925)

  • The spider_opened() and spider_closed() methods of SpiderState are deprecated. Use the new spider_state_loaded and spider_state_saving signals instead. (#5153, #7650, #7656)

  • The spider and to_native_str_type parameters of scrapy.robotstxt.decode_robotstxt() are deprecated and have no effect. (#8316)

  • Calling AsyncCrawlerRunner.crawl() without a running asyncio event loop while TWISTED_REACTOR_ENABLED is False is deprecated. Call it from a coroutine that runs in the event loop instead, e.g. one passed to asyncio.run(). (#7201, #7681, #8327)

  • ImagesPipeline.convert_image() has a new image_format keyword-only parameter with the original image format. Overriding the method without that parameter, and calling it without it, are deprecated. (#8198, #8457)

  • The SCRAPER_SLOT_MAX_ACTIVE_SIZE setting is deprecated. Use RESPONSE_MAX_ACTIVE_SIZE instead.

    scrapy.core.scraper.Slot is deprecated as well, and so are the active_size and max_active_size attributes and the needs_backout() method of Scraper.slot. Use ExecutionEngine.response_active_size, RESPONSE_MAX_ACTIVE_SIZE and ExecutionEngine.needs_backout() instead.

    (#6430)

  • Using a Twisted reactor other than AsyncioSelectorReactor is deprecated, be it set through the TWISTED_REACTOR setting, installed by code outside Scrapy, or passed to install_reactor(). Setting TWISTED_REACTOR to None or "" is deprecated as well. Remove any custom TWISTED_REACTOR setting from your code.

    The FORCE_CRAWLER_PROCESS setting is deprecated as well.

    (#8111, #8454)

  • Passing an encoding that web browsers do not support, e.g. cp437, to the encoding parameter of TextResponse is deprecated. To decode a response body with such an encoding, use response.body.decode(encoding). (#8393)

  • scrapy.utils.response.get_base_url() and scrapy.utils.response.get_meta_refresh() are deprecated. Use the new TextResponse.base_url and TextResponse.meta_refresh attributes instead. When there is no meta refresh, the latter is None instead of (None, None). (#8393)

  • The METAREFRESH_IGNORE_TAGS setting is deprecated. Use the new METAREFRESH_SCRIPTING setting instead. (#8393)

New features

Improvements

Bug fixes

  • FTPDownloadHandler now raises DownloadFailedError when the server drops the connection, so that those downloads are retried. (#1511, #8206)

  • FilesPipeline now treats responses with the 201 status code as successful downloads. (#8349)

  • The Cookie header now lists cookies with the same path length from oldest to newest, as RFC 6265 Section 5.4 requires. (#5431, #8321)

  • The runspider command now runs the given file even if its name matches that of an already imported module, e.g. json.py. (#8036, #8463)

  • The check command now reports errors that prevent a spider from crawling, e.g. errors raised while creating the spider, instead of silently ignoring them. (#3716, #7991)

  • Request.from_curl() now handles headers without a value (-H 'Name;') as curl does, ignores headers that curl would not send, supports -u with a user name and no password, and raises ValueError for an empty command, instead of failing with unexpected exceptions. It also turns -H 'Name:' into a header set to None, i.e. not sent, instead of a header with an empty value, accepts Bash $'…' quoting in any argument, e.g. headers, although it does not decode backslash escapes, and keeps a leading $ in request data instead of removing it.

    Request.to_curl() now includes every value of repeated headers, handles headers set to None and no longer fails on headers that are not valid UTF-8.

    (#8131, #8138, #8148, #8267, #8291, #8292)

  • Headers.to_tuple_list() no longer raises UnicodeDecodeError; bytes that cannot be decoded are replaced with U+FFFD. (#2592, #2637, #8192)

  • copy.copy() on an Item now returns a shallow copy, like Item.copy(). It used to return an item that shared its fields with the original, so that setting or deleting a field on one also did it on the other. (#8172)

  • Calling exit() or quit() in the telnet console now closes the connection, instead of logging an unhandled error. (#3853, #8065)

  • An exception raised while building the SCHEDULER is now reported as is, instead of being followed by a RuntimeError about an unassigned engine slot. (#8169)

  • The lastseen field of the representation of a downloader slot, e.g. in the telnet console, now shows the monotonic timestamp of the last activity instead of a meaningless date. (#8182)

  • SitemapSpider now resolves relative and protocol-relative URLs in sitemaps against the sitemap URL. (#965, #8210)

  • CrawlSpider now follows the links of a response also when the callback of the matching rule raises an exception. (#4108, #8200)

  • A feed URI with a placeholder that is neither a spider attribute nor returned by the uri_params function now makes only that feed be skipped, with an error logged, instead of raising KeyError and leaving the remaining feeds unopened. (#2089, #8205)

  • Fixed the file modification times that FilesPipeline reads from Amazon S3, Google Cloud Storage and FTP storages to apply FILES_EXPIRES. S3 and Google Cloud Storage times were off by the UTC offset of the local time zone, and FTP times were misread. (#8186, #8196)

  • Lines of a callback docstring that start with @ but do not name a registered contract, e.g. a decorator in a code example, are now ignored, instead of raising KeyError or making the check command treat the callback as having contracts. As a result, a misspelled contract name is also ignored. (#8226)

  • The bench command now listens on a random free port, instead of failing when port 8998 is in use. (#8230)

  • CONCURRENT_REQUESTS_PER_DOMAIN and the concurrency key of DOWNLOAD_SLOTS are now enforced when using asyncio with no download delay. (#8256, #8257)

  • SitemapSpider now detects XML sitemaps also in responses that are not XmlResponse objects, e.g. from third-party download handlers, based on their headers, URL and body. (#6362, #7904)

  • Fixed the handling of headers that are not valid UTF-8 or ASCII in some download handlers:

    • HttpxDownloadHandler no longer fails on non-ASCII request headers.

    • AiohttpDownloadHandler no longer fails on request or response headers that are not valid UTF-8. Invalid UTF-8 in request headers is sent as U+FFFD, with a warning.

    • H2DownloadHandler no longer fails, or hangs, on request or response headers that are not valid UTF-8.

    (#8265)

  • Headers.get() now returns the given default value for a header set to None. (#8268)

  • Fixed the downloader/request_bytes and downloader/response_bytes stats, which miscounted line breaks for requests with all headers set to None and for responses with multi-value headers, and scrapy.utils.request.request_httprepr(), which added an extra line break for requests with all headers set to None. (#8266, #8271)

  • Changing the header values in the output of Request.to_dict() or Response.to_dict() no longer changes the original request or response. (#8269)

  • HTTP11DownloadHandler now closes the proxy connection of an HTTPS request that times out, or is otherwise cancelled, before the proxy has established the tunnel. (#3614, #7810)

  • RedirectMiddleware no longer copies the fragment of the original URL into the redirect URL when the Location header ends with an empty fragment (#). (#8100)

  • When using a job directory, the default scheduler now pops requests by priority across its memory and disk queues, instead of popping every request from the memory queue before any from the disk queue.

    Custom SCHEDULER_PRIORITY_QUEUE classes need to implement the new next_priority() method to get this behavior. PriorityQueueProtocol documents the interface of priority queue classes. (#3666, #8237)

  • When resuming a crawl from a job directory, feeds whose URI uses %(batch_id)d now continue the batch numbering of the previous run, instead of starting from 1 again and overwriting the existing files. (#5153, #7650, #7656)

  • Item exporters now serialize nested items, and lists of them, using the serializers declared in their own fields. (#3888, #3890, #8057)

  • Fixed AsyncioLoopingCall sometimes calling its function twice in a row when the event loop woke it up slightly early, which could, for example, close a spider because of CLOSESPIDER_TIMEOUT_NO_ITEM while it was still producing items. (#8294)

  • The RobotFileParser parser now ignores the invalid bytes of a robots.txt file that is not valid UTF-8, like the other built-in parsers, instead of ignoring the whole file. (#8316)

  • Exceptions raised while handling the output of a spider callback, e.g. by a custom scheduler or log formatter, are now logged, and no longer interfere with the handling of the rest of that output. (#8318)

  • Scrapy now uses the event loop of the installed asyncio reactor when no event loop is running, instead of the current event loop of the thread, which can be a different one or none at all, e.g. when the reactor was installed with a loop that is not set as the current one. (#7201, #8324, #8325)

  • Stopping a crawl while an item yielded from start() is going through the item pipelines no longer hangs. (#8348)

  • H2DownloadHandler now fails requests with the connection error when it cannot connect to the server, instead of letting them hit the download timeout, and later requests to the same server try to connect again. (#8332)

  • Fixed ScrapyPriorityQueue, which the default DownloaderAwarePriorityQueue uses for each download slot, returning no request or a request other than the one that its peek() method returned, which could happen with requests of the same priority in its start request and regular request queues, or after a request failed to be serialized into a disk queue. (#7837)

  • The telnet console, and any other caller of scrapy.utils.reactor.listen_tcp(), now tries the next port when another process starts listening on the same port at the same time, instead of failing to start. (#8356)

  • Fixed RobotsTxtMiddleware letting through requests disallowed by robots.txt when they were sent while the robots.txt file of their website was being downloaded for another request. (#8297, #8386)

  • SitemapSpider now only treats links with rel="alternate" as alternate links, instead of any link, e.g. canonical ones, both when sitemap_alternate_links is enabled and in the entries passed to sitemap_filter(). (#8390)

  • Download handlers are now closed when the engine is closed without having been started, e.g. when opening the spider fails, and the downloader is now closed when the engine is stopped without a spider. (#8167, #8377)

  • The spider is no longer considered idle, and so no longer closed, while a request taken from the scheduler has not reached the downloader yet, which could happen with a custom DOWNLOADER. (#8315, #8355)

  • The reactorless shell now waits for the engine to start before letting you use it. (#8168)

  • On Windows, AiohttpDownloadHandler no longer connects to the wrong port in rare cases. (#8382)

  • The Scrapy shell no longer uses ptpython on Windows when the standard output is not a console, which ptpython does not support. (#8367)

Documentation

Quality assurance

Scrapy 2.19.0 (2026-09-10)

Highlights:

  • New RemoteControl extension which allows inspecting and controlling a running crawl over HTTP, used by the Scrapy MCP server

  • Experimental aiohttp-based download handler (now the default when running without a reactor)

Modified requirements

Backward-incompatible changes

Deprecations

  • The RANDOMIZE_DOWNLOAD_DELAY setting is deprecated. Use the new DOWNLOAD_DELAY_JITTER setting instead. Similarly, the randomize_delay key of the DOWNLOAD_SLOTS setting is deprecated in favor of a new jitter key, the randomize_delay attribute of scrapy.core.downloader.Slot is deprecated in favor of its new jitter attribute, and the randomize_delay attribute of scrapy.core.downloader.Downloader is deprecated in favor of the DOWNLOAD_DELAY_JITTER setting. (#7881)

  • The install_root_handler parameter of configure_logging(), CrawlerProcess and AsyncCrawlerProcess is deprecated. Use the new LOG_INSTALL_ROOT_HANDLER setting instead. (#4793, #8041)

  • The scrapy.dupefilters.RFPDupeFilter.fingerprints attribute is deprecated. Overriding scrapy.dupefilters.RFPDupeFilter.request_fingerprint() is deprecated as well; set the REQUEST_FINGERPRINTER_CLASS setting instead. (#5517, #7943)

  • Overriding the add_pre_hook() or add_post_hook() methods of Contract is deprecated. Define pre_process() or post_process() instead. (#6681, #7886)

New features

  • Added a RemoteControl extension, enabled by default, which allows connecting to crawl processes via HTTP and running code inside them. (#7866)

  • Added an experimental HTTP download handler based on aiohttp, AiohttpDownloadHandler. (#8118)

  • Added SQLite-backed scheduler queues: PickleFifoSQLiteQueue, PickleLifoSQLiteQueue, MarshalFifoSQLiteQueue and MarshalLifoSQLiteQueue. They write each request within its own transaction, so that an unclean shutdown cannot corrupt the on-disk queue, at the cost of slower scheduling. (#845, #7877)

  • Added a DOWNLOAD_DELAY_JITTER setting, and a jitter key for DOWNLOAD_SLOTS, which set the magnitude of the random variation applied to DOWNLOAD_DELAY. They replace the RANDOMIZE_DOWNLOAD_DELAY setting and the randomize_delay key, which could only toggle a fixed ±50%. (#7881)

  • Added a LOG_COLOR setting, which colorizes log output by log level when logging to a terminal. It needs the new color extra. (#8091)

  • The encoding of a response that doesn’t declare one is now detected with charset-normalizer when the response body is neither ASCII nor UTF-8, instead of always falling back to cp1252. (#3135, #8054)

  • Added a LOG_INSTALL_ROOT_HANDLER setting, which replaces the deprecated install_root_handler parameter and, unlike it, can also be set from a settings.py module or from the command line. (#4793, #8041)

  • Contracts now support callbacks defined with async def, including asynchronous generators. (#6681, #7886)

  • Added the MethodContract (@method), BodyContract (@body), HeaderContract (@header) and CookieContract (@cookie) contracts, which set the corresponding attributes of the sample request, and an -a option for the check command, to set spider arguments as in the crawl command. (#1918, #8053)

  • Added Response.to_dict(), Response.from_dict() and response_from_dict(), and used them in the built-in HTTP cache storages, which now restore cached responses of any response class, including those of third-party plugins, with all their attributes. (#1450, #7908)

  • Cached responses now indicate when they were stored, through the new cache_timestamp request meta key. (#2221, #8034)

  • The format key of FEEDS is now inferred from the file extension of the feed URI when not set, e.g. json for a URI ending in .json. (#1158, #8031)

  • Added find_projects(), which yields the root directory of every Scrapy project in a directory tree. (#8024)

  • Added a public scheduler attribute to ExecutionEngine. (#8099)

  • StatsCollector objects now implement __str__(), which returns the pretty-printed stats. (#2746)

  • open_in_browser() now also supports responses that are neither HTML nor plain text, picking a file extension based on the Content-Type header. (#3902, #8067)

  • The -t/--template option of the genspider command now also takes a path to a .tmpl file, so that a custom template can be used without setting TEMPLATES_DIR. (#8071)

  • The --pdb command-line option now uses ipdb instead of pdb when ipdb is installed. (#4284, #8052)

  • Log records about item processing, i.e. about items scraped, dropped or raising an exception, now carry the item in their extra dict, under the item key, so that custom logging handlers can read it. (#8085)

Improvements

  • RFPDupeFilter now keeps request fingerprints as bytes, to reduce memory usage. The requests.seen file that it writes in the job directory is now a binary file. (#5517, #7943)

  • The --pdb command-line option now starts a post-mortem debugging session on every logged error that comes with a traceback, instead of on every Failure object built anywhere in the process. (#3552, #8037)

  • The Scrapy shell no longer prints the DEBUG messages of parso, an indirect dependency of IPython, when LOG_LEVEL is DEBUG. (#8060)

  • Other code refactoring and improvements. (#8123)

Bug fixes

Documentation

Quality assurance

Scrapy 2.18.0 (2026-08-20)

Highlights:

Modified requirements

  • brotli (brotlicffi on PyPy) and Zstandard support (the standard library compression.zstd module on Python 3.14 and higher, the backports.zstd package on earlier versions) are now required, so br and zstd are always included in the Accept-Encoding header of requests, and Brotli- and Zstandard-compressed responses are always decoded. Websites may now serve such responses to crawls that previously did not advertise support for them.

    The minimum required versions are brotli 1.2.0, brotlicffi 1.2.0.0 and backports.zstd 1.3.0.

    (#4698, #6978, #7083, #7929, #8009)

  • Increased the minimum versions of the following dependencies:

    (#7841, #7874, #7879, #8001)

  • The IPython shell requires IPython 8.15.0 or higher. Install the ipython extra to get a compatible version. (#5447, #7596, #7816)

Backward-incompatible changes

  • The following runtime usage of zope.interface interfaces is removed:

    (#6585, #7731)

  • The engine, extensions, logformatter, request_fingerprinter and stats attributes of Crawler raise RuntimeError when read before the crawl starts, instead of being None until then.

    Code that reads them from the spider_opened signal handler onwards is unaffected, and no longer needs to narrow their type. Code that checked whether they were set, e.g. if crawler.stats:, must be updated, since reading them now raises instead of returning None.

    (#6136, #7882)

  • Item exporters now export the fields of an item in declaration order, i.e. the order in which they are defined in the item class, instead of the order in which they were populated, as CsvItemExporter already did. dict items, which have no declared fields, keep using the key order of each item. (#6662, #6854, #7824)

  • scrapy.utils.serialize.ScrapyJSONEncoder, used by JSON feed exports, the telnet console and the PeriodicLog extension, now serializes datetime, date and time objects in ISO 8601 format, e.g. 2023-08-03T23:24:57.148903+00:00 instead of 2023-08-03 23:24:57, keeping microseconds and time zone information.

    Its DATE_FORMAT and TIME_FORMAT attributes are removed.

    (#2087, #7918)

  • scrapy.utils.trackref.live_refs is now a WeakKeyDictionary instead of a collections.defaultdict, so that classes defined at run time are released once they are no longer used. Reading the entry of a class with no tracked instances now raises KeyError instead of creating and returning an empty mapping. (#5995, #7922)

  • The MEMDEBUG_NOTIFY setting is removed. It had no effect, but code reading it now gets None instead of its default value, which was an empty list. (#7737)

  • scrapy.utils.log.logformatter_adapter() no longer passes the whole dict returned by a log formatter method as logging arguments when that dict has no args key, or its args are empty, and its msg has no %(name)s placeholders. Such messages are now logged verbatim, so a literal % in them no longer breaks logging.

    An args tuple is now expanded into one logging argument per item, so that %-style placeholders work with it as they do with a dict.

    (#5570, #5572, #7936)

  • FEEDS keys and FEED_URI values that are pathlib.Path objects are now used as paths, instead of being converted into file:// URIs. This makes them keep working when they contain URI parameters or characters that URI conversion would percent-encode. (#5794, #6425, #6611, #7674)

  • Selector and TextResponse.selector no longer force the html selector type for responses that are neither HtmlResponse nor XmlResponse objects. A JsonResponse gets the json type, and for any other response parsel determines the type from the body.

    The response class, and hence the selector type, comes from the content type that the website reports. When a website reports the wrong content type, recast the response, e.g. response.replace(cls=HtmlResponse).

    (#4627, #5291, #6025, #7924, #7972)

  • AutoThrottle no longer sets the download_delay attribute of the running spider to define the starting delay of download slots. The starting delay is still applied, but code that reads that attribute at run time no longer sees it. (#7167, #7175, #7833)

  • The check command now ignores ITEM_PIPELINES and FEEDS, since contracts check the output of callbacks instead of sending it to item processing, so a check run no longer triggers their side effects, e.g. writing an empty output file. Use the -s command-line option to set them back for a check run. (#3385, #7957)

  • XMLFeedSpider and CSVFeedSpider no longer raise NotConfigured when parse_node() or parse_row() is not defined; the resulting AttributeError is reported instead. (#7768)

Deprecation removals

  • scrapy.utils.misc.md5sum(), deprecated since Scrapy 2.12.0, is removed. (#6264, #8023)

  • scrapy.utils.iterators.xmliter(), deprecated since Scrapy 2.11.1 because it is vulnerable to ReDoS attacks, is removed. Use xmliter_lxml() instead. (#7765)

  • scrapy.utils.datatypes.CaselessDict, deprecated since Scrapy 2.10.0, is removed. Use CaseInsensitiveDict instead. (#5146, #8023)

Deprecations

  • The download_delay spider attribute is deprecated. Use the DOWNLOAD_DELAY setting, or DOWNLOAD_SLOTS to set a delay for specific domains, instead.

    The max_concurrent_requests spider attribute, deprecated since Scrapy 2.14.0, now sets the CONCURRENT_REQUESTS_PER_DOMAIN setting, which is what it always mapped to, and warns accordingly.

    Both attributes are ignored, with a different warning, when the corresponding setting is already set at the spider priority or higher.

    (#7167, #7175, #7833)

  • The Spider.log() method is deprecated. Use the methods of Spider.logger instead. (#7739)

  • The scrapy.interfaces module and its ISpiderLoader interface are deprecated. Custom spider loaders only need to follow SpiderLoaderProtocol. (#6585, #7731)

  • scrapy.extensions.feedexport.IFeedStorage is deprecated. Custom feed storages only need to follow scrapy.extensions.feedexport.FeedStorageProtocol. (#6585, #7731)

  • scrapy.utils.python.re_rsearch() is deprecated. (#7765)

  • Importing FileException from scrapy.pipelines.files is deprecated. Import it from scrapy.pipelines.media instead. (#7544, #7673, #7973)

  • Setting request.meta["is_secure"] to False to send an s3:// request over plaintext HTTP is deprecated. The flag will be ignored in a future Scrapy version. (#7738)

  • The unused multiplier attribute of PeriodicLog is deprecated. (#7809, #7982)

  • Returning, from a log formatter method, a msg with %(name)s placeholders and no args is deprecated. Those placeholders are still interpolated with the returned dict, but in a future Scrapy version the message will be logged verbatim. Return those values under args instead. (#5570, #7971)

New features

Bug fixes

  • HttpCacheMiddleware now logs a warning and handles the request as a cache miss when reading a cache entry raises an exception, e.g. because the entry is corrupted, instead of letting the exception propagate. It also counts those entries in the new httpcache/retrieve_error stat. (#2222, #7805)

  • Feed URIs now only expand %(...)s parameters, keeping any other percent character as is, so that percent-encoded URIs, e.g. one with %20 in a path or with percent-encoded FTP credentials, are no longer misinterpreted as printf-style formatting directives. (#5794, #6425, #7674)

  • Feed exports now start storing a FEED_EXPORT_BATCH_ITEM_COUNT batch as soon as it is complete, instead of waiting until the spider closes. (#7730, #7733)

  • CsvItemExporter now warns when the fields that it took from the first item do not cover the fields of a later item, i.e. when it silently drops data. (#4002, #4053, #7613, #7651)

  • GCSFeedStorage no longer requires the storage.buckets.get permission. (#5475, #7945)

  • Media pipelines now log media requests that were filtered out, e.g. as offsite requests, at the DEBUG level and without a traceback, instead of reporting them as download errors. (#7544, #7673)

  • OffsiteMiddleware now raises IgnoreRequest with a message, e.g. Filtered offsite request to 'offsite.example', which errbacks and log messages that report that exception now include. (#7544, #7673)

  • HTTP11DownloadHandler now skips response header lines that have no colon, logging them at the DEBUG level, as web browsers do, instead of being unable to download such a response at all. (#210, #7806)

  • CookiesMiddleware now sends domain cookies to hosts without a dot in their name and to hosts given as an IP address. (#6410, #7900)

  • TextResponse.json() now decodes bodies that are not valid UTF-8, UTF-16 or UTF-32 using TextResponse.encoding, instead of raising UnicodeDecodeError. (#6456, #7897)

  • scrapy.resolver.CachingHostnameResolver now caches addresses without a port, and sets the requested port on cache hits, so that a cached address no longer carries the port of the request that populated the cache. (#6442, #7772)

  • DownloaderAwarePriorityQueue now removes the directory of a download slot from the JOBDIR directory once that slot is drained. (#5275, #7955)

  • TelnetConsole no longer raises an exception on shutdown when it could not listen on any of the TELNETCONSOLE_PORT ports. (#2702, #7910)

  • The DOWNLOAD_WARNSIZE warning is no longer logged twice for a response whose Content-Length header already exceeded the limit. (#2476, #7963)

  • HttpCompressionMiddleware now logs a warning when it drops a response for exceeding DOWNLOAD_MAXSIZE during decompression. (#6616, #7742)

  • DepthMiddleware now logs only the first request ignored for exceeding DEPTH_LIMIT, and counts them all in the new depth/request_ignored_count stat. (#1308, #7916)

  • parse now sets the callback it uses on the request of the response it passes to that callback. (#3095, #3124, #7803)

  • The IPython shell now works when an asyncio event loop is already running in the same thread, e.g. when calling scrapy.shell.inspect_response() from a callback while using the asyncio reactor. (#5447, #7816)

  • Request.from_curl() now merges repeated -d, --data and --data-raw options into a single body joined with &, as curl does, instead of keeping only the last one. (#7728)

  • The copy() method and the |= operator of scrapy.utils.datatypes.CaseInsensitiveDict no longer leave the internal mapping of original key spellings shared or out of date. (#7783)

  • ExecutionEngine.download_async() no longer recurses once per returned request, e.g. once per redirect. (#7544, #7673)

  • LinkExtractor now canonicalizes each extracted URL once instead of twice when canonicalize is True. (#7961)

  • Items yielded from Spider.start() now keep the spider busy until the item pipelines are done with them, so that a spider that only yields items from start() no longer closes before processing them. (#7029, #7891)

  • open_in_browser() now also adds its base tag to HTML responses that have no head element, and it now overrides a base tag already present in the response, so that relative URLs resolve against the response URL in every case. (#6550, #7879)

  • Spider.start() implementations that are not asynchronous generators now raise TypeError with a message that says so, instead of failing in a way that does not point at the cause. (#5426, #7946)

  • The check, fetch and parse commands now return the exit code 1 when a component fails to initialize, as crawl and runspider already did. (#4292, #7920)

  • HttpCompressionMiddleware no longer hangs on a deflate response body followed by extra bytes. (#7841)

  • scrapy.utils.python.get_func_args() now reports the parameters that a functools.partial object binds by position, instead of an empty list. (#7841)

  • Fixed NameError exceptions on Python 3.14, where PEP 649 made annotation evaluation lazy, when inspecting the signature of a callable with annotations imported only for type checking. (#7796, #7818)

  • scrapy.utils.decorators.deprecated can now be used both as @deprecated and as @deprecated(...) without confusing type checkers. (#7797)

  • The default download handlers can now download from domains with emoji characters or underscores, which were previously rejected. (#3321, #4330, #7846)

  • Callbacks and media pipeline results no longer wait 100 ms before proceeding. (#8019)

  • Shutting down a crawl no longer risks raising an unhandled RuntimeError if the code interrupted by the shutdown signal was itself writing to the log. (#8022)

  • Nested selectors, e.g. the result of calling jmespath() on a selector, now let parsel determine their type instead of forcing the html type, so that they no longer return the wrong type or value. (#8038, #8040)

Documentation

Quality assurance

Scrapy 2.17.0 (2026-07-07)

Highlights:

  • Security bug fixes

  • HTTP/2 and SOCKS proxy support for HttpxDownloadHandler

  • Improved settings for changing allowed TLS versions

Security bug fixes

  • s3:// requests now use HTTPS by default, instead of plaintext HTTP.

    Previously, S3DownloadHandler sent signed S3 requests over plaintext HTTP unless request.meta["is_secure"] was set to a true value, exposing the request path, the AWS Authorization header, the X-Amz-Security-Token header (when using temporary credentials), and the response contents to network attackers, who could also tamper with responses. See the 76g3-c3x4-crvx security advisory for details.

    To restore the previous behavior for a given request, set request.meta["is_secure"] to False.

Deprecations

  • The DOWNLOADER_CLIENT_TLS_METHOD setting is deprecated. You should use the DOWNLOAD_TLS_MIN_VERSION and/or DOWNLOAD_TLS_MAX_VERSION settings instead if you want to change the TLS method selection. (#3288, #6546)

  • The following spider attributes are deprecated in favor of settings:

    (#7590)

  • The scrapy.commands.ScrapyCommand.help() method is deprecated. It was never called by Scrapy. (#7626, #7633)

  • The following TLS-related functions and constants, intended for internal use, are deprecated:

    • scrapy.core.downloader.tls.METHOD_TLS

    • scrapy.core.downloader.tls.METHOD_TLSv10

    • scrapy.core.downloader.tls.METHOD_TLSv11

    • scrapy.core.downloader.tls.METHOD_TLSv12

    • scrapy.core.downloader.tls.openssl_methods

    • scrapy.core.downloader.tls.DEFAULT_CIPHERS

    • scrapy.utils.ssl.ffi_buf_to_string()

    • scrapy.utils.ssl.get_temp_key_info()

    • scrapy.utils.ssl.x509name_to_string()

    (#6546, #7619, #7665)

  • The CRAWLSPIDER_FOLLOW_LINKS setting is deprecated. You can set follow=False in your rules to achieve the same effect. (#7592)

  • Instantiating HttpCompressionMiddleware without a crawler argument is deprecated. (#7655)

  • Instantiating RefererMiddleware without a settings argument is deprecated. (#7664)

New features

Improvements

Bug fixes

  • HttpxDownloadHandler no longer ignores proxy credentials for redirected or retried requests. (#7601, #7630)

  • GCSFeedStorage now closes the temporary file after the upload. (#7546)

  • Fixed scrapy shell <URL> running a full spider crawl when there is a spider for the requested URL. This bug was introduced in Scrapy 2.13.0. (#7552, #7557)

  • The IMAGES_STORE_S3_ACL and IMAGES_STORE_GCS_ACL settings are no longer ignored. This bug was introduced in Scrapy 2.12.0. (#7597, #7614)

  • FTPDownloadHandler now closes the connection after making the request. (#7602, #7667)

  • Removed the deprecated spider argument from the pipeline defined in the default project template. (#7676)

  • Fixed scrapy genspider --edit not working. (#7260, #7683)

  • When a Crawler instance is passed to AsyncCrawlerRunner.create_crawler() or CrawlerRunner.create_crawler(), settings from both classes are now merged, previously only the settings from the Crawler instance were used. (#1280, #7647)

  • Fixed several issues with cookie handling in scrapy.utils.request.request_to_curl(). (#7603, #7675, #7684)

  • Fixed scrapy.resolver.CachingThreadedResolver not disabling the cache when DNSCACHE_ENABLED is set to False. (#7663)

  • Fixed scrapy.utils.response.open_in_browser() not removing comments when looking for the <base> tag. (#7506)

  • Fixed checking for deprecated methods in custom ITEM_PROCESSOR implementations. (#7589)

  • Fixed scrapy.utils.url.strip_url() corrupting some URLs with credentials. (#7604, #7605)

  • scrapy.utils.misc.rel_has_nofollow() now ignores the case when looking for “nofollow” strings. (#7632)

  • Fixed an exception in scrapy.utils.sitemap.Sitemap when parsing some malformed sitemaps. (#7686, #7687)

Documentation

Quality assurance

Scrapy 2.16.0 (2026-05-19)

Highlights:

  • Official support for Python 3.14

  • Support for Twisted 26.4.0+

Modified requirements

Backward-incompatible changes

  • The following classes and functions, intended for internal use by HTTP11DownloadHandler and H2DownloadHandler, have been made private:

    • scrapy.core.downloader.handlers.http11.ScrapyAgent

    • scrapy.core.downloader.handlers.http11.ScrapyProxyAgent

    • scrapy.core.downloader.handlers.http11.TunnelingAgent

    • scrapy.core.downloader.handlers.http11.TunnelingTCP4ClientEndpoint

    • scrapy.core.downloader.handlers.http11.tunnel_request_data()

    • scrapy.core.downloader.handlers.http2.ScrapyH2Agent

    (#7496, #7510)

Deprecations

Deprecation removals

  • The start_requests() method of Spider, deprecated in 2.13.0, is removed and no longer called. Use start() instead, or both to maintain support for lower Scrapy versions. (#7490)

  • Support for process_start_requests() methods of spider middlewares, deprecated in 2.13.0, is removed. Use process_start() instead, or both to maintain support for lower Scrapy versions. (#7490)

  • Support for synchronous process_spider_output() methods of spider middlewares, deprecated in Scrapy 2.13.0, is removed. You should upgrade the affected middlewares to have asynchronous process_spider_output() methods. (#7504)

  • The spider arguments of the following methods of Scraper, deprecated in Scrapy 2.13.0, are removed:

    • close_spider()

    • enqueue_scrape()

    • handle_spider_error()

    • handle_spider_output()

    (#7487)

  • HTTP/1.0 support code, deprecated in Scrapy 2.13.0, is removed. This includes:

    • scrapy.core.downloader.handlers.http10.HTTP10DownloadHandler

    • The scrapy.core.downloader.webclient module.

    • The DOWNLOADER_HTTPCLIENTFACTORY setting.

    (#7486)

  • The following functions, deprecated in Scrapy 2.13.0, are removed, you should import them from w3lib.url directly instead:

    • scrapy.utils.url.add_or_replace_parameter()

    • scrapy.utils.url.add_or_replace_parameters()

    • scrapy.utils.url.any_to_uri()

    • scrapy.utils.url.canonicalize_url()

    • scrapy.utils.url.file_uri_to_path()

    • scrapy.utils.url.is_url()

    • scrapy.utils.url.parse_data_uri()

    • scrapy.utils.url.parse_url()

    • scrapy.utils.url.path_to_file_uri()

    • scrapy.utils.url.safe_download_url()

    • scrapy.utils.url.safe_url_string()

    • scrapy.utils.url.url_query_cleaner()

    • scrapy.utils.url.url_query_parameter()

    (#7487)

  • The following test-related code, deprecated in Scrapy 2.13.0, is removed:

    • the scrapy.utils.testproc module

    • the scrapy.utils.testsite module

    • scrapy.utils.test.assert_gcs_environ()

    • scrapy.utils.test.get_ftp_content_and_delete()

    • scrapy.utils.test.get_gcs_content_and_delete()

    • scrapy.utils.test.mock_google_cloud_storage()

    • scrapy.utils.test.skip_if_no_boto()

    • scrapy.utils.test.TestSpider

    (#7487)

  • scrapy.utils.versions.scrapy_components_versions(), deprecated in Scrapy 2.13.0, is removed, you can use scrapy.utils.versions.get_versions() instead. (#7487)

  • scrapy.downloadermiddlewares.ajaxcrawl.AjaxCrawlMiddleware and scrapy.utils.url.escape_ajax(), deprecated in Scrapy 2.13.0, are removed. (#7487)

  • The __init__() method of priority queue classes (see SCHEDULER_PRIORITY_QUEUE) now needs to support a keyword-only start_queue_cls parameter, not supporting it was deprecated in Scrapy 2.13.0. (#7487)

  • scrapy.spiders.init.InitSpider, deprecated in Scrapy 2.13.0, is removed. (#7487)

New features

Improvements

Bug fixes

Documentation

Quality assurance

  • Added tests that connect to https://books.toscrape.com/ to test the behavior with a real website. These tests are marked with the requires_internet pytest mark and can be skipped with e.g. -m 'not requires_internet' if you cannot or don’t want to run them. (#7520)

  • Type hints improvements and fixes. (#7492, #7532)

  • CI and test improvements and fixes. (#7441, #7466, #7491, #7496)

Scrapy 2.15.2 (2026-04-28)

Bug fixes

Scrapy 2.15.1 (2026-04-23)

Bug fixes

Scrapy 2.15.0 (2026-04-09)

Highlights:

  • Experimental support for running without a Twisted reactor

  • Experimental httpx-based download handler

Backward-incompatible changes

  • The built-in HTTP download handlers now raise Scrapy-specific exceptions instead of implementation-specific ones, see Exceptions raised by download handlers. This can affect user code that handles downloader exceptions, such as process_exception() methods of custom downloader middlewares. (#7208)

  • In order to fix a long-standing bug with handling of asynchronous storages, the following changes were made to media pipeline classes, which can impact some of the user code that subclasses them or calls their methods directly:

    • overrides of scrapy.pipelines.media.MediaPipeline.media_downloaded() and file_downloaded() can now return coroutines

    • media_downloaded(), file_downloaded() and image_downloaded() now return coroutines

    (#2183, #6369, #7182)

  • Request and Response objects: __slots__ and setter changes:

    • scrapy.http.Request and scrapy.http.Response now define __slots__. Assigning arbitrary attributes to instances (for example, response.foo = 1) will raise AttributeError. Store per-request/response data in the request/response meta mapping instead of attaching new attributes to the objects.

    • If you maintain custom Request or Response subclasses that relied on dynamic instance attributes, either add '__dict__' to your subclass __slots__ to allow dynamic attributes, or migrate per-instance state to meta or explicit documented attributes.

    • The setters for headers, flags and cookies no longer coerce falsy values into None. For example, request.headers = {} now stores an empty scrapy.http.headers.Headers instance (not None), and request.flags = [] remains an empty list instead of being set to None. Update code that relied on is None checks or the previous coercion behaviour.

    (#7036, #7367, #7374)

Deprecation removals

  • The context factory class set as the value of the DOWNLOADER_CLIENTCONTEXTFACTORY setting is now required to support the method argument of __init__(), recommended since Scrapy 1.2.0. (#7353)

Deprecations

  • scrapy.mail.MailSender is deprecated. Please use smtplib, twisted.mail.smtp or other 3rd party email libraries. (#7249, #7263)

  • The scrapy.extensions.statsmailer.StatsMailer extension is deprecated. You can instead implement your own notifications by handling the spider_closed signal. (#7249, #7263)

  • The MEMUSAGE_NOTIFY_MAIL setting is deprecated. You can instead implement your own notifications by handling the memusage_warning_reached and spider_closed signals. (#7249, #7263)

  • The DNS_RESOLVER setting was renamed to TWISTED_DNS_RESOLVER and the old name is deprecated. (#7350, #7361)

  • The DOWNLOADER_CLIENTCONTEXTFACTORY setting is deprecated. If you were using it to switch to scrapy.core.downloader.contextfactory.BrowserLikeContextFactory, please use the new DOWNLOAD_VERIFY_CERTIFICATES setting instead. If you cannot use the default context factory for some other reason, please subclass the download handler instead. (#7352, #7379)

  • scrapy.core.downloader.contextfactory.BrowserLikeContextFactory is deprecated. You can set the new DOWNLOAD_VERIFY_CERTIFICATES setting to True instead. (#7379)

  • The following implementation details of the context factory handling code are deprecated:

    • scrapy.core.downloader.contextfactory.AcceptableProtocolsContextFactory

    • scrapy.core.downloader.contextfactory.load_context_factory_from_settings()

    • scrapy.core.downloader.contextfactory.ScrapyClientContextFactory

    • scrapy.core.downloader.tls.ScrapyClientTLSOptions

    (#7353, #7391)

  • Passing str instead of bytes to scrapy.utils.sitemap.Sitemap and scrapy.utils.sitemap.sitemap_urls_from_robots() is deprecated. (#7007)

  • scrapy.utils.misc.walk_modules() is deprecated. You can use scrapy.utils.misc.walk_modules_iter() instead. (#7388)

  • scrapy.shell.Shell.inthread is deprecated. You can use scrapy.shell.Shell.fetch_available instead to check if fetch() can be used. (#7395)

  • scrapy.commands.ScrapyCommand.set_crawler() is deprecated. (#7276)

New features

Improvements

Bug fixes

Documentation

Quality assurance

Scrapy 2.14.2 (2026-03-12)

Security bug fixes

  • Values from the Referrer-Policy header of HTTP responses are no longer executed as Python callables. See the cwxj-rr6w-m6w7 security advisory for details.

  • In line with the standard, 301 redirects of POST requests are converted into GET requests.

    Converting to a GET request implies not only a method change, but also omitting the body and Content-* headers in the redirect request. On cross-origin redirects (for example, cross-domain redirects), this is effectively a security bug fix for scenarios where the body contains secrets.

Deprecations

  • Passing a response URL string as the first positional argument to scrapy.spidermiddlewares.referer.RefererMiddleware.policy() is deprecated. Pass a Response instead.

    The parameter has also been renamed to response to reflect this change. The old parameter name (resp_or_url) is deprecated.

New features

  • Added a new setting, REFERRER_POLICIES, to allow customizing supported referrer policies.

Bug fixes

  • Made additional redirect scenarios convert to GET in line with the standard:

    • Only POST 302 redirects are converted into GET requests; other methods are preserved.

    • HEAD 303 redirects are not converted into GET requests.

    • GET 303 redirects do not have their body or standard Content-* headers removed.

  • Redirects where the original request body is dropped now also have their Content-Encoding, Content-Language and Content-Location headers removed, in addition to the Content-Type and Content-Length headers that were already being removed.

  • Redirects now preserve the source URL fragment if the redirect URL does not include one. This is useful when using browser-based download handlers, such as scrapy-playwright or scrapy-zyte-api, while letting Scrapy handle redirects.

  • The Referer header is now removed on redirect if RefererMiddleware is disabled.

  • The handling of the Referer header on redirects now takes into account the Referer-Policy header of the response that triggers the redirect.

Scrapy 2.14.1 (2026-01-12)

Deprecations

  • scrapy.utils.defer.maybeDeferred_coro() is deprecated. (#7212)

Bug fixes

  • Fixed custom stats collectors that require a spider argument in their open_spider() and close_spider() methods not receiving the argument when called by the engine.

    Note, however, that the spider argument is now deprecated and will stop being passed in a future version of Scrapy.

    (#7213)

Quality assurance

  • Replaced deprecated codecov/test-results-action@v1 GitHub Action with codecov/codecov-action@v5. (#7180, #7215)

Scrapy 2.14.0 (2026-01-05)

Highlights:

  • More coroutine-based replacements for Deferred-based APIs

  • The default priority queue is now DownloaderAwarePriorityQueue

  • Dropped support for Python 3.9 and PyPy 3.10

  • Improved and documented the API for custom download handlers

Modified requirements

  • Dropped support for Python 3.9. (#7121)

  • Dropped support for PyPy 3.10. (#7050)

  • Increased the minimum versions of the following dependencies:

    • lxml: 4.6.0 → 4.6.4

    • Pillow (optional dependency): 8.0.0 → 8.3.2

    • botocore (optional dependency): 1.4.87 → 1.13.45

  • Restored support for brotlicffi dropped in Scrapy 2.13.4. Its minimum supported version is now 1.2.0.0. (#7160)

Backward-incompatible changes

  • If you set the TWISTED_REACTOR setting to a non-asyncio value at the spider level, you may now need to set the FORCE_CRAWLER_PROCESS setting to True when running Scrapy via its command-line tool to avoid a reactor mismatch exception. (#6845)

  • The log_count/* stats no longer count some of the early messages that they counted before. While the earliest log messages, emitted before the counter is initialized, were never counted, the counter initialization now happens later than in previous Scrapy versions. You may need to adjust expected values if you retrieve and compare values of these stats in your code. (#7046)

  • The classes listed below are now abstract base classes. They cannot be instantiated directly and their subclasses need to override the abstract methods listed below to be able to be instantiated. If you previously instantiated these classes directly, you will now need to subclass them and provide trivial (e.g. empty) implementations for the abstract methods.

    (#6930)

  • Scrapy no longer passes a spider argument to any methods of the stats collector. It wasn’t passed in many of the calls even in older Scrapy versions, so we don’t expect existing custom stats collector implementations to require a spider argument. If your implementation needs a Spider instance, you can get it from the Crawler instance passed to the constructor. (#7011)

  • scrapy.middleware.MiddlewareManager no longer includes code for handling open_spider() and close_spider() component methods. As this code was only used for pipelines it was moved into scrapy.pipelines.ItemPipelineManager. This change should only affect custom subclasses of MiddlewareManager. The following code was moved:

    • scrapy.middleware.MiddlewareManager.open_spider()

    • scrapy.middleware.MiddlewareManager.close_spider()

    • Code in scrapy.middleware.MiddlewareManager._add_middleware() that processes open_spider() and close_spider() component methods.

    (#7006)

  • scrapy.downloadermiddlewares.robotstxt.RobotsTxtMiddleware.process_request() now returns a coroutine, previously it returned a Deferred object or None. The robot_parser() method was also changed to return a coroutine. This change only impacts code that subclasses RobotsTxtMiddleware or calls its methods directly. (#6802)

  • The built-in download handlers have been refactored, changing the signatures of their methods. This change should only affect user code that subclasses any of these handlers or calls their methods directly. (#6778, #7164)

  • scrapy.pipelines.media.MediaPipeline.process_item() now returns a coroutine, previously it returned a Deferred object. This change only impacts code that calls this method directly. (#7177)

Deprecation removals

  • The from_settings() method of the following components, deprecated in Scrapy 2.12.0, is removed. You should use from_crawler() instead.

    (#7126)

  • Scrapy no longer calls from_settings() methods of 3rd-party components, deprecated in Scrapy 2.12.0. You should define a from_crawler() method instead. (#7126)

  • The initialization flow of scrapy.pipelines.media.MediaPipeline and its subclasses was simplified, it now mandates from_crawler() methods and crawler arguments of __init__() methods. Not using these was deprecated in Scrapy 2.12.0. (#7126)

  • The REQUEST_FINGERPRINTER_IMPLEMENTATION setting, deprecated in Scrapy 2.12.0, is removed. (#7126)

  • The scrapy.utils.misc.create_instance() function, deprecated in Scrapy 2.12.0, is removed. Use scrapy.utils.misc.build_from_crawler() instead. (#7126)

  • The scrapy.core.downloader.Downloader._get_slot_key() function, deprecated in Scrapy 2.12.0, is removed. Use scrapy.core.downloader.Downloader.get_slot_key() instead. (#7126)

  • The scrapy.twisted_version attribute, deprecated in Scrapy 2.12.0, is removed. You should instead use the twisted.version attribute directly. (#7126)

  • The following utility functions, deprecated in Scrapy 2.12.0, are removed:

    • scrapy.utils.defer.process_chain_both()

    • scrapy.utils.python.equal_attributes()

    • scrapy.utils.python.flatten()

    • scrapy.utils.python.iflatten()

    • scrapy.utils.request.request_authenticate()

    • scrapy.utils.test.assert_samelines()

    (#7126)

  • scrapy.utils.serialize.ScrapyJSONDecoder, deprecated in Scrapy 2.12.0, is removed. (#7126)

  • The scrapy.extensions.feedexport.build_storage() function, deprecated in Scrapy 2.12.0, is removed, you can instead call the builder callable directly. (#7126)

  • scrapy.spidermiddlewares.offsite.OffsiteMiddleware, deprecated in Scrapy 2.11.2, is removed. scrapy.downloadermiddlewares.offsite.OffsiteMiddleware should be used instead. (#6926)

Deprecations

  • The following methods that return a Deferred are deprecated in favor of their coroutine-based replacements:

    • scrapy.core.downloader.handlers.DownloadHandlers

      • download_request() (use download_request_async())

    • scrapy.core.downloader.middleware.DownloaderMiddlewareManager

      • download() (use download_async())

    • scrapy.core.engine.ExecutionEngine

    • scrapy.core.scraper.Scraper

      • open_spider() (use open_spider_async())

      • call_spider() (use call_spider_async())

      • close_spider() (use close_spider_async())

      • handle_spider_output() (use handle_spider_output_async())

      • start_itemproc() (use start_itemproc_async())

    • scrapy.core.spidermw.SpiderMiddlewareManager

      • scrape_response() (use scrape_response_async())

    • scrapy.crawler.Crawler

    • scrapy.pipelines.ItemPipelineManager

      • process_item() (use process_item_async())

      • open_spider() (use open_spider_async())

      • close_spider() (use close_spider_async())

    • scrapy.signalmanager.SignalManager

    • scrapy.utils.signal.send_catch_log_deferred() (use scrapy.utils.signal.send_catch_log_async())

    (#6791, #6842, #6979, #6997, #6999, #7005, #7043, #7069, #7161, #7164)

  • The following spider attributes are deprecated in favor of settings:

    (#6988, #6994, #7038, #7039, #7117, #7176)

  • Returning a Deferred from the following user-defined functions is deprecated in favor of defining them as coroutine functions:

    • spider callbacks and errbacks (which was never officially supported and may work incorrectly)

    • the process_request(), process_response() and process_exception() methods of custom downloader middlewares

    • the process_item(), open_spider() and close_spider() methods of custom pipelines

    • signal handlers

    • the download_request() and close() methods of custom download handlers

    (#6718, #6778, #7069, #7147, #7148, #7149, #7150, #7151, #7161, #7164, #7179)

  • Passing a spider argument to the following methods is deprecated:

    • scrapy.core.spidermw.SpiderMiddlewareManager.process_start()

    • scrapy.core.downloader.Downloader.fetch()

    • scrapy.core.downloader.Downloader._get_slot()

    • scrapy.core.downloader.handlers.DownloadHandlers.download_request()

    • all public methods of scrapy.statscollectors.StatsCollector

    • scrapy.spidermiddlewares.base.BaseSpiderMiddleware.process_spider_output()

    • scrapy.spidermiddlewares.base.BaseSpiderMiddleware.process_spider_output_async()

    • all process_*() methods of built-in downloader middlewares

    • all process_*() methods of built-in spider middlewares

    • scrapy.pipelines.media.MediaPipeline.open_spider()

    • scrapy.pipelines.media.MediaPipeline.process_item()

    (#6750, #6927, #6984, #7006, #7011, #7033, #7037, #7045, #7178)

  • Instantiating subclasses of scrapy.middleware.MiddlewareManager without a Crawler instance is deprecated. (#6984)

  • For the following user-defined functions and methods requiring a spider argument is deprecated, if you need a Spider instance inside them you should get it from the Crawler instance (you may need to refactor your code to save that instance in e.g. the from_crawler() method):

    • the process_request(), process_response() and process_exception() methods of custom downloader middlewares

    • the process_spider_input(), process_spider_output(), process_spider_output_async() and process_spider_exception() methods of custom spider middlewares

    • the process_item() method of custom pipelines

    • the fetch() method of a custom DOWNLOADER

    (#6927, #6984, #7006, #7037)

  • The following things in custom download handlers are deprecated:

    • not having a lazy attribute (you should define it as True if you want to keep the current behavior)

    • returning a Deferred from the download_request() method (you should refactor it to return a coroutine; you also need to remove the spider argument when doing this)

    • not having a close() method, having a synchronous one or one that returns a Deferred (you should refactor it to return a coroutine or add an empty one if you don’t have it)

    (#6778, #7164)

  • Custom implementations of ITEM_PROCESSOR should now define process_item_async(), open_spider_async() and close_spider_async() methods instead of, or in addition to, process_item(), open_spider() and close_spider(). (#7005, #7043)

  • The CONCURRENT_REQUESTS_PER_IP setting is deprecated, use CONCURRENT_REQUESTS_PER_DOMAIN instead. (#6917, #6921)

  • The scrapy.core.downloader.handlers.http module is deprecated. You should import scrapy.core.downloader.handlers.http11.HTTP11DownloadHandler directly instead of importing the scrapy.core.downloader.handlers.http.HTTPDownloadHandler alias. (#7079)

  • The scrapy.utils.decorators.defers() decorator is deprecated, you can use twisted.internet.defer.maybeDeferred() directly or reimplement this decorator in your code. (#7164)

  • scrapy.spiders.CrawlSpider._parse_response() is deprecated, use scrapy.spiders.CrawlSpider.parse_with_rules() instead. (#4463, #6804)

  • The functions that add a delay to a Deferred are deprecated, their underlying Twisted functions can be used instead, either directly if a delay isn’t needed, or with some explicit way to add a delay if it’s needed:

    (#6937)

New features

Improvements

Bug fixes

Documentation

Quality assurance

Older releases