Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jadbin committed Aug 3, 2018
1 parent e92b5e8 commit 4799165
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ Change log
New features
~~~~~~~~~~~~

- 新增 ``request_ignored`` 事件
- 添加 ``request_ignored`` 事件
- Field添加 ``type`` 参数,表示该字段的类型,在获取该字段的值时会进行类型转换
- 添加 ``StopCluster`` 异常,用于在spider在回调函数中停止cluster

Refactoring
~~~~~~~~~~~
Expand Down Expand Up @@ -80,7 +81,7 @@ New features

- 中间件的加载细分为内置中间件和用户自定义中间件两部分,内置中间件自动加载,用户中间件的加载由配置项确定;
中间件加载的顺序由配置的权值确定,权值越大越贴近downloader/spider
- 添加 ``xpaw.errors.NotEnabled`` ,在中间件/拓展的构造函数中控制抛出该异常来实现开启或禁用该中间件/拓展。
- 添加 ``NotEnabled`` 异常,在中间件/拓展的构造函数中控制抛出该异常来实现开启或禁用该中间件/拓展。
- 添加UserAgentMiddleware,支持选择PC端或移动端的User-Agent,支持随机User-Agent
- 支持配置日志写入指定文件

Expand Down
34 changes: 34 additions & 0 deletions docs/errors.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.. _errors:

Errors
======

Built-in Errors
---------------

这里给出了内置的错误类型。


.. class:: xpaw.errors.NotEnabled

在加载组件的时候抛出的异常,表示该组件未启用。

.. class:: xpaw.errors.NetworkError

在downloader下载过程中抛出的异常,例如超时、服务器无法访问等。

.. class:: xpaw.errors.IgnoreRequest

在处理 :class:`~xpaw.http.HttpRequest` 时抛出的异常,表示忽略该request,例如到达了一定的重试次数等。

.. class:: xpaw.errors.IgnoreItem

在处理 :class:`~xpaw.item.Item` 时抛出的异常,表示忽略该item。

.. class:: xpaw.errors.UsageError

xpaw相关命令使用方法不正确时抛出的异常。

.. class:: xpaw.errors.CloseCluster

在spider的处理 :class:`~xpaw.http.HttpResponse` 的回调函数中可以抛出该异常,主动停止cluster。
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Table of Contents
req_resp
selector
settings
errors

.. toctree::
:caption: Advanced Usage
Expand Down

0 comments on commit 4799165

Please sign in to comment.