[MRG+1] Allow to specify the quotechar in CSVFeedSpider #882
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
this PR make it possible to pass a quotechar to the csviter (and csv.reader) and specify which enclosing/quoting character to use in the CSVFeedSpider. Today it is only possible to set a custom delimiter [1] but no other parameters to the csv.reader and a question may also be if it is enough with quotechar or if the csviter should expose more, like dialects [2] to be even more generic.
This solves a scenario when a CSV file use any other quoting character than the default (
"
, quotation mark), such as the single quote'
. Without this the keys and values will be enclosed by the single quote, e.g.u"'key'"
.[1] http://doc.scrapy.org/en/latest/topics/spiders.html#csvfeedspider
[2] https://docs.python.org/2/library/csv.html#csv.reader