python - CsvItemExporter 子类中的 Scrapy 1.0+ 正确设置访问?

标签 python web-scraping scrapy

以前,访问 CsvItemExporter 的子类中的设置,我需要修改设置中指定的分隔符,可以使用:

from scrapy.conf import settings

但是该方法现在已贬值:

ScrapyDeprecationWarning: Module scrapy.conf is deprecated, use crawler.settings attribute instead from scrapy.conf import settings

我现在该怎么做?常用的from_crawler,“from_settings类方法在CsvItemExporter中不起作用。

最佳答案

目前无法使用附加参数扩展提要导出器。事实上,存在一个功能请求要求它:[Enhancement] Allow BaseItemExporter to accept arguments #973

还有 2 个关于允许自定义 CSV 分隔符的功能请求:

因此,我建议您跟踪这些请求,考虑为它们投票(即添加一个竖起大拇指的 react )或以其他方式提供反馈,与此同时,您可以忽略警告、禁止警告,或者使用 nyov’s approach。 .

关于python - CsvItemExporter 子类中的 Scrapy 1.0+ 正确设置访问?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32911906/

相关文章:

python - 创建新的 DataFrame 作为其他 DataFrame 列的有序组合

python - self 是 __init__ 和其他方法/函数中的要求吗?

python-3.x - Python3 - 网页抓取 zomato - 多个页面

python - Scrapy 单元测试

python - Scrapy Spider 在同一页面获取两张图片,然后以不同的方式命名它们

Python:安装在远程服务器上时无法使导入工作

python - Pytorch模型精度测试

google-sheets - 如果股票行情中有一个点,IMPORTXML 无法从雅虎财经获取

python - 按计划进行 Scrapy

python - Scrapy - 根据文本选择特定链接