Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jadbin committed Jul 14, 2018
1 parent 46c1482 commit e268127
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Refactoring
- cluster的 ``stats_center`` 更名为 ``stats_collector`` ,配置项 ``stats_center_cls`` 更名为 ``stats_collector``
- 调整了中间件加载顺序权值
- HttpRequest对 ``auth`` 、 ``cookie_jar`` 、 ``proxy`` 、 ``proxy_auth`` 的配置移至 ``meta`` 属性中。
- SetDupeFilter更名为HashDupeFilter

0.9.1 (2018-04-16)
------------------
Expand Down
59 changes: 59 additions & 0 deletions docs/core_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ Cluster API
爬虫相关的配置项,对于 :attr:`~xpaw.cluster.LocalCluster.config` 的使用可以参考 :ref:`config_api` 。


.. method:: start()

启动cluster

.. method:: shutdown(sig=None)

停止cluster

:param sig: 停止信号


.. _config_api:

Config API
Expand All @@ -65,3 +76,51 @@ Config API

:param values: 需要更新的配置项
:type values: dict or :class:`~xpaw.config.BaseConfig`

.. method:: get(name, default=None)

获取配置

:param str name: 参数名称
:param default: 缺省值

.. method:: getbool(name, default=None)

获取 ``bool`` 型参数,如果值不能转换为 ``bool`` 类型,返回 ``None`` 。

.. method:: getint(name, default=None)

获取 ``int`` 型参数,如果值不能转换为 ``int`` 类型,返回 ``None`` 。

.. method:: getint(name, default=None)

获取 ``float`` 型参数,如果值不能转换为 ``float`` 类型,返回 ``None`` 。

.. method:: getlist(name, default=None)

将参数值封装为 ``list`` 并返回。
如果参数值是 ``str`` ,则会根据 ``,`` 分隔为多个参数值。

.. method:: set(name, value):

设置参数值

:param str name: 参数名称
:param value: 参数值

.. method:: update(values):

更新参数

:param values: 新的参数
:type values: dict or :class:`~xpaw.config.BaseConfig`

.. method:: delete(name):

删除参数

:param name: 参数名称

.. method:: copy()

复制配置
8 changes: 4 additions & 4 deletions docs/req_resp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ Request API

.. method:: copy()

复制request
复制request

.. method:: replace(**kwargs)

复制request并替换部分属性
复制request并替换部分属性

.. _request_meta:

Expand Down Expand Up @@ -161,8 +161,8 @@ Response API

.. method:: copy()

复制response
复制response

.. method:: replace(**kwargs)

复制response并替换部分属性
复制response并替换部分属性

0 comments on commit e268127

Please sign in to comment.