Previously, accessing settings in a subclass of CsvItemExporter
, which I need to modify the delimiter specified in the settings, could be done using:
from scrapy.conf import settings
However that method is now depreciated:
ScrapyDeprecationWarning: Module
scrapy.conf
is deprecated, usecrawler.settings
attribute instead from scrapy.conf import settings
How can I do it now? The usual from_crawler
, "from_settings
class methods don't work in CsvItemExporter
.
There is currently no way to extend feed exporters with additional parameters. In fact, a feature request exists asking for it: [Enhancement] Allow BaseItemExporter to accept arguments #973
There are also 2 feature requests about allowing to customize the CSV delimiter:
CsvItemExporter delimiter should be changeable through settings.py #3252
Adding delimiter, quotechar, encoding, lineterminator options to the CSV exporter #3486
So, I suggest you track those requests, consider voting for them (i.e. adding a thumbs up reaction) or providing feedback otherwise, and in the meantime you can either ignore the warning, supress it, or go with nyov’s approach.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With