diff --git a/docs/faq.rst b/docs/faq.rst index f593e4f16..80d258b55 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -160,7 +160,7 @@ Can I use JSON for large exports? --------------------------------- It'll depend on how large your output is. See :ref:`this warning -` in :class:`~scrapy.contrib.exporter.JsonItemExporter` +` in :class:`~scrapy.exporters.JsonItemExporter` documentation. Can I return (Twisted) deferreds from signal handlers? diff --git a/docs/topics/exporters.rst b/docs/topics/exporters.rst index 43846852b..af469eb7b 100644 --- a/docs/topics/exporters.rst +++ b/docs/topics/exporters.rst @@ -4,7 +4,7 @@ Item Exporters ============== -.. module:: scrapy.contrib.exporter +.. module:: scrapy.exporters :synopsis: Item Exporters Once you have scraped your items, you often want to persist or export those @@ -40,7 +40,7 @@ Here you can see an :doc:`Item Pipeline ` which uses an Item Exporter to export scraped items to different files, one per spider:: from scrapy import signals - from scrapy.contrib.exporter import XmlItemExporter + from scrapy.exporters import XmlItemExporter class XmlExportPipeline(object): @@ -117,7 +117,7 @@ after your custom code. Example:: - from scrapy.contrib.exporter import XmlItemExporter + from scrapy.exporter import XmlItemExporter class ProductXmlExporter(XmlItemExporter): diff --git a/docs/topics/feed-exports.rst b/docs/topics/feed-exports.rst index 8166a7a4e..27d601a19 100644 --- a/docs/topics/feed-exports.rst +++ b/docs/topics/feed-exports.rst @@ -37,7 +37,7 @@ JSON ---- * :setting:`FEED_FORMAT`: ``json`` - * Exporter used: :class:`~scrapy.contrib.exporter.JsonItemExporter` + * Exporter used: :class:`~scrapy.exporters.JsonItemExporter` * See :ref:`this warning ` if you're using JSON with large feeds. @@ -47,7 +47,7 @@ JSON lines ---------- * :setting:`FEED_FORMAT`: ``jsonlines`` - * Exporter used: :class:`~scrapy.contrib.exporter.JsonLinesItemExporter` + * Exporter used: :class:`~scrapy.exporters.JsonLinesItemExporter` .. _topics-feed-format-csv: @@ -55,7 +55,7 @@ CSV --- * :setting:`FEED_FORMAT`: ``csv`` - * Exporter used: :class:`~scrapy.contrib.exporter.CsvItemExporter` + * Exporter used: :class:`~scrapy.exporters.CsvItemExporter` * To specify columns to export and their order use :setting:`FEED_EXPORT_FIELDS`. Other feed exporters can also use this option, but it is important for CSV because unlike many other export @@ -67,7 +67,7 @@ XML --- * :setting:`FEED_FORMAT`: ``xml`` - * Exporter used: :class:`~scrapy.contrib.exporter.XmlItemExporter` + * Exporter used: :class:`~scrapy.exporters.XmlItemExporter` .. _topics-feed-format-pickle: @@ -75,7 +75,7 @@ Pickle ------ * :setting:`FEED_FORMAT`: ``pickle`` - * Exporter used: :class:`~scrapy.contrib.exporter.PickleItemExporter` + * Exporter used: :class:`~scrapy.exporters.PickleItemExporter` .. _topics-feed-format-marshal: @@ -83,7 +83,7 @@ Marshal ------- * :setting:`FEED_FORMAT`: ``marshal`` - * Exporter used: :class:`~scrapy.contrib.exporter.MarshalItemExporter` + * Exporter used: :class:`~scrapy.exporters.MarshalItemExporter` .. _topics-feed-storage: @@ -300,11 +300,11 @@ FEED_EXPORTERS_BASE Default:: FEED_EXPORTERS_BASE = { - 'json': 'scrapy.contrib.exporter.JsonItemExporter', - 'jsonlines': 'scrapy.contrib.exporter.JsonLinesItemExporter', - 'csv': 'scrapy.contrib.exporter.CsvItemExporter', - 'xml': 'scrapy.contrib.exporter.XmlItemExporter', - 'marshal': 'scrapy.contrib.exporter.MarshalItemExporter', + 'json': 'scrapy.exporters.JsonItemExporter', + 'jsonlines': 'scrapy.exporters.JsonLinesItemExporter', + 'csv': 'scrapy.exporters.CsvItemExporter', + 'xml': 'scrapy.exporters.XmlItemExporter', + 'marshal': 'scrapy.exporters.MarshalItemExporter', } A dict containing the built-in feed exporters supported by Scrapy. diff --git a/scrapy/contrib/exporter/__init__.py b/scrapy/exporters/__init__.py similarity index 100% rename from scrapy/contrib/exporter/__init__.py rename to scrapy/exporters/__init__.py diff --git a/scrapy/settings/default_settings.py b/scrapy/settings/default_settings.py index 3323386aa..17db550a7 100644 --- a/scrapy/settings/default_settings.py +++ b/scrapy/settings/default_settings.py @@ -139,13 +139,13 @@ FEED_STORAGES_BASE = { } FEED_EXPORTERS = {} FEED_EXPORTERS_BASE = { - 'json': 'scrapy.contrib.exporter.JsonItemExporter', - 'jsonlines': 'scrapy.contrib.exporter.JsonLinesItemExporter', - 'jl': 'scrapy.contrib.exporter.JsonLinesItemExporter', - 'csv': 'scrapy.contrib.exporter.CsvItemExporter', - 'xml': 'scrapy.contrib.exporter.XmlItemExporter', - 'marshal': 'scrapy.contrib.exporter.MarshalItemExporter', - 'pickle': 'scrapy.contrib.exporter.PickleItemExporter', + 'json': 'scrapy.exporters.JsonItemExporter', + 'jsonlines': 'scrapy.exporters.JsonLinesItemExporter', + 'jl': 'scrapy.exporters.JsonLinesItemExporter', + 'csv': 'scrapy.exporters.CsvItemExporter', + 'xml': 'scrapy.exporters.XmlItemExporter', + 'marshal': 'scrapy.exporters.MarshalItemExporter', + 'pickle': 'scrapy.exporters.PickleItemExporter', } HTTPCACHE_ENABLED = False diff --git a/tests/py3-ignores.txt b/tests/py3-ignores.txt index cf814c15c..8e5c5dc9b 100644 --- a/tests/py3-ignores.txt +++ b/tests/py3-ignores.txt @@ -4,7 +4,7 @@ tests/test_command_fetch.py tests/test_command_shell.py tests/test_commands.py tests/test_command_version.py -tests/test_contrib_exporter.py +tests/test_exporters.py tests/test_contrib_linkextractors.py tests/test_contrib_loader.py tests/test_crawl.py diff --git a/tests/test_contrib_exporter.py b/tests/test_exporters.py similarity index 99% rename from tests/test_contrib_exporter.py rename to tests/test_exporters.py index 746aeb65b..df1f8f4d5 100644 --- a/tests/test_contrib_exporter.py +++ b/tests/test_exporters.py @@ -9,7 +9,7 @@ import lxml.etree from scrapy.item import Item, Field from scrapy.utils.python import str_to_unicode -from scrapy.contrib.exporter import ( +from scrapy.exporters import ( BaseItemExporter, PprintItemExporter, PickleItemExporter, CsvItemExporter, XmlItemExporter, JsonLinesItemExporter, JsonItemExporter, PythonItemExporter )