mirror of https://github.com/scrapy/scrapy.git
Add a reference section for the built-in feed storage classes
This commit is contained in:
parent
8e7f25d086
commit
8bd27fa7b4
|
|
@ -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 <spider_name> -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
|
||||
|
|
|
|||
|
|
@ -186,6 +186,8 @@ class BlockingFeedStorage(ABC):
|
|||
|
||||
|
||||
class StdoutFeedStorage:
|
||||
""":ref:`Standard output <topics-feed-storage-stdout>` storage backend."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
uri: str,
|
||||
|
|
@ -212,6 +214,12 @@ class StdoutFeedStorage:
|
|||
|
||||
|
||||
class FileFeedStorage:
|
||||
""":ref:`Local filesystem <topics-feed-storage-fs>` 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 <topics-feed-storage-s3>` storage backend."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
uri: str,
|
||||
|
|
@ -325,6 +335,8 @@ class S3FeedStorage(BlockingFeedStorage):
|
|||
|
||||
|
||||
class GCSFeedStorage(BlockingFeedStorage):
|
||||
""":ref:`GCS <topics-feed-storage-gcs>` storage backend."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
uri: str,
|
||||
|
|
@ -376,6 +388,9 @@ class GCSFeedStorage(BlockingFeedStorage):
|
|||
|
||||
|
||||
class FTPFeedStorage(BlockingFeedStorage):
|
||||
""":ref:`FTP <feed-storage-ftp>` storage backend, which also handles
|
||||
:ref:`FTPS <feed-storage-ftps>` when *uri* uses the ``ftps`` scheme."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
uri: str,
|
||||
|
|
|
|||
Loading…
Reference in New Issue