Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Merge branch 'master' into feat/FixFeedExport

Andrey Rakhmatullin8a64f3e8de4a
diff --cc scrapy/extensions/feedexport.py
index 9aaf4a1fd,bcf0b779a..de3ed093c
--- a/scrapy/extensions/feedexport.py
+++ b/scrapy/extensions/feedexport.py
@@@ -271,9 -274,11 +274,9 @@@ class FTPFeedStorage(BlockingFeedStorag
)
- class _FeedSlot:
+ class FeedSlot:
def __init__(
self,
- file,
- exporter,
storage,
uri,
format,
@@@ -468,7 -455,23 +492,21 @@@ class FeedExporter
:param uri_template: template of uri which contains %(batch_time)s or %(batch_id)d to create new uri
"""
storage = self._get_storage(uri, feed_options)
- slot = _FeedSlot(
+ file = storage.open(spider)
+ if "postprocessing" in feed_options:
+ file = PostProcessingManager(
+ feed_options["postprocessing"], file, feed_options
+ )
+
+ exporter = self._get_exporter(
+ file=file,
+ format=feed_options["format"],
+ fields_to_export=feed_options["fields"],
+ encoding=feed_options["encoding"],
+ indent=feed_options["indent"],
+ **feed_options["item_export_kwargs"],
+ )
+ slot = FeedSlot(
- file=file,
- exporter=exporter,
storage=storage,
uri=uri,
format=feed_options["format"],