From 8bd27fa7b485e80772963ae534415cdf6697d69c Mon Sep 17 00:00:00 2001 From: Adrian Chaves Date: Wed, 12 Aug 2026 18:55:38 +0200 Subject: [PATCH] Add a reference section for the built-in feed storage classes --- docs/topics/feed-exports.rst | 28 ++++++++++++++++++++++++---- scrapy/extensions/feedexport.py | 15 +++++++++++++++ 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/docs/topics/feed-exports.rst b/docs/topics/feed-exports.rst index b6aa0be42..20ce922dc 100644 --- a/docs/topics/feed-exports.rst +++ b/docs/topics/feed-exports.rst @@ -676,10 +676,11 @@ Default: "ftps": "scrapy.extensions.feedexport.FTPFeedStorage", } -A dict containing the built-in feed storage backends supported by Scrapy. You -can disable any of these backends by assigning ``None`` to their URI scheme in -:setting:`FEED_STORAGES`. E.g., to disable the built-in FTP storage backend -(without replacement), place this in your ``settings.py``: +A dict containing the built-in feed storage backends supported by Scrapy, see +:ref:`feed-storage-classes`. You can disable any of these backends by assigning +``None`` to their URI scheme in :setting:`FEED_STORAGES`. E.g., to disable the +built-in FTP storage backend (without replacement), place this in your +``settings.py``: .. code-block:: python @@ -840,6 +841,25 @@ source spider in the feed URI: scrapy crawl -o "%(spider_name)s.jsonl" +.. _feed-storage-classes: + +Storage backend classes +======================= + +These are the classes that :setting:`FEED_STORAGES_BASE` assigns to the +built-in URI schemes. + +.. autoclass:: FileFeedStorage + +.. autoclass:: FTPFeedStorage + +.. autoclass:: GCSFeedStorage + +.. autoclass:: S3FeedStorage + +.. autoclass:: StdoutFeedStorage + + .. _URIs: https://en.wikipedia.org/wiki/Uniform_Resource_Identifier .. _Amazon S3: https://aws.amazon.com/s3/ .. _Canned ACL: https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl diff --git a/scrapy/extensions/feedexport.py b/scrapy/extensions/feedexport.py index ad94ba40f..728f1d5a7 100644 --- a/scrapy/extensions/feedexport.py +++ b/scrapy/extensions/feedexport.py @@ -186,6 +186,8 @@ class BlockingFeedStorage(ABC): class StdoutFeedStorage: + """:ref:`Standard output ` storage backend.""" + def __init__( self, uri: str, @@ -212,6 +214,12 @@ class StdoutFeedStorage: class FileFeedStorage: + """:ref:`Local filesystem ` storage backend. + + *uri* may be a ``file://`` URI or a plain path. Missing parent directories + are created when the feed is opened. + """ + def __init__(self, uri: str, *, feed_options: dict[str, Any] | None = None): self.path: str = file_uri_to_path(uri) if uri.startswith("file:") else uri feed_options = feed_options or {} @@ -231,6 +239,8 @@ class FileFeedStorage: class S3FeedStorage(BlockingFeedStorage): + """:ref:`Amazon S3 ` storage backend.""" + def __init__( self, uri: str, @@ -325,6 +335,8 @@ class S3FeedStorage(BlockingFeedStorage): class GCSFeedStorage(BlockingFeedStorage): + """:ref:`GCS ` storage backend.""" + def __init__( self, uri: str, @@ -376,6 +388,9 @@ class GCSFeedStorage(BlockingFeedStorage): class FTPFeedStorage(BlockingFeedStorage): + """:ref:`FTP ` storage backend, which also handles + :ref:`FTPS ` when *uri* uses the ``ftps`` scheme.""" + def __init__( self, uri: str,