Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
looyolo
scrapy
提交
f8f5f463
S
scrapy
项目概览
looyolo
/
scrapy
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
scrapy
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
f8f5f463
编写于
7月 11, 2018
作者:
D
Daniel Graña
提交者:
GitHub
7月 11, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3253 from rpkilby/depth-stats
[MRG+1] Update depth middleware stats (fixes #3245)
上级
9c6d2652
6a182c95
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
6 addition
and
16 deletion
+6
-16
docs/topics/settings.rst
docs/topics/settings.rst
+0
-11
docs/topics/spider-middleware.rst
docs/topics/spider-middleware.rst
+2
-1
scrapy/settings/default_settings.py
scrapy/settings/default_settings.py
+1
-1
scrapy/spidermiddlewares/depth.py
scrapy/spidermiddlewares/depth.py
+3
-3
未找到文件。
docs/topics/settings.rst
浏览文件 @
f8f5f463
...
...
@@ -335,17 +335,6 @@ See also: :ref:`faq-bfo-dfo` about tuning Scrapy for BFO or DFO.
other priority settings :setting:`REDIRECT_PRIORITY_ADJUST`
and :setting:`RETRY_PRIORITY_ADJUST`.
.. setting:: DEPTH_STATS
DEPTH_STATS
-----------
Default: ``True``
Scope: ``scrapy.spidermiddlewares.depth.DepthMiddleware``
Whether to collect maximum depth stats.
.. setting:: DEPTH_STATS_VERBOSE
DEPTH_STATS_VERBOSE
...
...
docs/topics/spider-middleware.rst
浏览文件 @
f8f5f463
...
...
@@ -212,7 +212,8 @@ DepthMiddleware
* :setting:`DEPTH_LIMIT` - The maximum depth that will be allowed to
crawl for any site. If zero, no limit will be imposed.
* :setting:`DEPTH_STATS` - Whether to collect depth stats.
* :setting:`DEPTH_STATS_VERBOSE` - Whether to collect the number of
requests for each depth.
* :setting:`DEPTH_PRIORITY` - Whether to prioritize the requests based on
their depth.
...
...
scrapy/settings/default_settings.py
浏览文件 @
f8f5f463
...
...
@@ -55,7 +55,7 @@ DEFAULT_REQUEST_HEADERS = {
}
DEPTH_LIMIT
=
0
DEPTH_STATS
=
Tru
e
DEPTH_STATS
_VERBOSE
=
Fals
e
DEPTH_PRIORITY
=
0
DNSCACHE_ENABLED
=
True
...
...
scrapy/spidermiddlewares/depth.py
浏览文件 @
f8f5f463
...
...
@@ -13,7 +13,7 @@ logger = logging.getLogger(__name__)
class
DepthMiddleware
(
object
):
def
__init__
(
self
,
maxdepth
,
stats
=
None
,
verbose_stats
=
False
,
prio
=
1
):
def
__init__
(
self
,
maxdepth
,
stats
,
verbose_stats
=
False
,
prio
=
1
):
self
.
maxdepth
=
maxdepth
self
.
stats
=
stats
self
.
verbose_stats
=
verbose_stats
...
...
@@ -41,7 +41,7 @@ class DepthMiddleware(object):
extra
=
{
'spider'
:
spider
}
)
return
False
el
if
self
.
stats
:
el
se
:
if
self
.
verbose_stats
:
self
.
stats
.
inc_value
(
'request_depth_count/%s'
%
depth
,
spider
=
spider
)
...
...
@@ -50,7 +50,7 @@ class DepthMiddleware(object):
return
True
# base case (depth=0)
if
self
.
stats
and
'depth'
not
in
response
.
meta
:
if
'depth'
not
in
response
.
meta
:
response
.
meta
[
'depth'
]
=
0
if
self
.
verbose_stats
:
self
.
stats
.
inc_value
(
'request_depth_count/0'
,
spider
=
spider
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录