Scrapy 2.6 Documentation
1.63 MB
384 页
0 评论
语言 | 格式 | 评分 |
---|---|---|
英语 | .pdf | 3 |
摘要 | ||
The Scrapy 2.6 documentation outlines various updates, deprecations, and new features in the framework. Key updates include the removal of deprecated classes such as HtmlParserLinkExtractor and RegexLinkExtractor, replaced by LinkExtractor. New features include support for Google Cloud Storage in feed exports, batch delivery settings, and improvements in request handling with --data-raw. Bug fixes address issues with dataclass items, ANSI escape sequences, and TLS compatibility. Documentation updates clarify settings, selector sections, and logging configurations. The release also emphasizes versioning, API stability, and deprecation policies, ensuring backward compatibility and clear upgrade paths. | ||
AI总结 | ||
以下是对《Scrapy 2.6 Documentation》的总结,重点突出核心内容和关键信息:
---
### **Scrapy 2.6.3 发布说明**
#### **弃用功能移除**
- 移除了 `scrapy.linkextractors` 中的以下类:
- `htmlparser.HtmlParserLinkExtractor`
- `regex.RegexLinkExtractor`
- `sgml.BaseSgmlLinkExtractor`
- `sgml.SgmlLinkExtractor`
建议使用 `LinkExtractor` 替代。
#### **新功能**
- 支持将 Feed 导出到 Google Cloud Storage。
- 添加了 `FEED_EXPORT_BATCH_ITEM_COUNT` 设置,用于批量交付。
- `parse` 命令现在允许指定输出文件。
- `Request.from_curl` 和 `curl_to_request_kwargs()` 支持 `--data-raw`。
- 内置爬虫子类(如 `CrawlSpider`)现在支持解析回调。
#### **错误修复**
- 修复了 CSV 导出对 `dataclass` 和 `attr.s` 项的支持问题。
- `Request.from_curl` 和 `curl_to_request_kwargs()` 在指定请求正文但未指定请求方法时,会默认设置为 POST 方法。
- 在 Windows 10.0.14393 及更高版本中启用 ANSI 转义序列处理,以支持彩色输出。
#### **文档更新**
- 更新了 `DOWNLOADER_CLIENT_TLS_CIPHERS` 设置的 OpenSSL 密码列表格式链接。
- 简化了“使用 dataclass 项”部分的代码示例。
---
### **其他版本更新**
#### **Scrapy 1.7.4**
- 恢复了一个与项加载器初始化相关的问题,可能导致后续 `ItemLoader.get_output_value()` 或 `ItemLoader.load_item()` 返回空数据。
#### **Scrapy 1.7.3**
- 对 Python 3.4 用户强制使用 lxml 4.3.5 或更低版本。
#### **Scrapy 1.7.2**
- 修复了 Python 2 的支持问题。
---
### **基础概念**
- **项目组件**:
- **爬虫 (Spiders)**:定义爬取规则。
- **选择器 (Selectors)**:从网页中提取数据,支持 XPath。
- **项 (Items)**:定义要抓取的数据结构。
- **项加载器 (Item Loaders)**:填充项数据。
- **项管道 (Item Pipeline)**:后处理和存储抓取的数据。
- **请求与响应**:了解 HTTP 请求和响应的类。
- **链接提取器**:提取页面中的链接。
- **设置**:配置 Scrapy 并查看所有可用设置。
---
### **版本与 API 稳定性**
- **版本格式**:A.B.C,分别表示主版本、发布版本和修复版本。
- **API 稳定性**:1.0 及以上版本为生产就绪版本。
- **弃用政策**:功能被弃用后至少保留 1 年,随后可能移除。
---
以上是文档的核心内容和关键信息的总结,重点突出了新功能、错误修复、弃用信息和版本更新。 |
P1
P2
P3
P4
P5
P6
P7
下载文档到本地,方便使用
- 可预览页数已用完,剩余
377 页请下载阅读 -
文档评分