Python.Scrapy.12-scrapy-source-code-analysis-part-2
Scrapy 源代码分析系列-2 signals, signalmanager, project, conf
1. 模块: signals.py signalmanager.py project.py conf.py
1.1 conf.py project.py
conf.py 是废弃的模块。她的功能由crawler.settings代替。 来自conf.py的代码如下:
if 'scrapy.cmdline' not in sys.modules:
from scrapy.utils.project import get_project_settings
settings = get_project_settings() import warnings
from scrapy.exceptions import ScrapyDeprecationWarning
warnings.warn("Module `scrapy.conf` is deprecated, use `crawler.settings` attribute instead",
ScrapyDeprecationWarning, stacklevel=2)
project.py 也是被废弃的模块。
1.2 interfaces.py
interfaces.py 定义了接口ISpiderManager, 接口方法如下:
def create(spider_name, **spider_args): 创建一个新的Spider对象。
def list(): 返回project中所有的spider。
def find_by_request(request): 处理request的sipder列表
该模块依赖: zope.interface (zope.interface), 关于该库另外进行分析。
1.3 signals.py signalmanager.py
signals.py 定义了一系列object类型的对象。
signalmanager.py 定义类SignalManager来管理signal。该类依赖 dispatcher 和 signal:
from scrapy.xlib.pydispatch import dispatcher
from scrapy.utils import signal
那么需要分析子包: scrapy.xlib
To Be Continued:
接下来分析模块: item.py link.py linkextractor.py log.py logformatter.py exceptions.py extension.py
Python.Scrapy.12-scrapy-source-code-analysis-part-2的更多相关文章
- Memcached source code analysis (threading model)--reference
Look under the start memcahced threading process memcached multi-threaded mainly by instantiating mu ...
- Golang Template source code analysis(Parse)
This blog was written at go 1.3.1 version. We know that we use template thought by followed way: fun ...
- Memcached source code analysis -- Analysis of change of state--reference
This article mainly introduces the process of Memcached, libevent structure of the main thread and w ...
- Apache Commons Pool2 源码分析 | Apache Commons Pool2 Source Code Analysis
Apache Commons Pool实现了对象池的功能.定义了对象的生成.销毁.激活.钝化等操作及其状态转换,并提供几个默认的对象池实现.在讲述其实现原理前,先提一下其中有几个重要的对象: Pool ...
- Redis source code analysis
http://zhangtielei.com/posts/blog-redis-dict.html http://zhangtielei.com/assets/photos_redis/redis_d ...
- linux kernel & source code analysis& hacking
https://kernelnewbies.org/ http://www.tldp.org/LDP/lki/index.html https://kernelnewbies.org/ML https ...
- 2018.6.21 HOLTEK HT49R70A-1 Source Code analysis
Cange note: “Reading TMR1H will latch the contents of TMR1H and TMR1L counter to the destination”? F ...
- The Ultimate List of Open Source Static Code Analysis Security Tools
https://www.checkmarx.com/2014/11/13/the-ultimate-list-of-open-source-static-code-analysis-security- ...
- Top 40 Static Code Analysis Tools
https://www.softwaretestinghelp.com/tools/top-40-static-code-analysis-tools/ In this article, I have ...
- Source Code Reading for Vue 3: How does `hasChanged` work?
Hey, guys! The next generation of Vue has released already. There are not only the brand new composi ...
随机推荐
- Swagger+Spring mvc生成Restful接口文档
简介 Swagger 是一个规范和完整的框架,用于生成.描述.调用和可视化 RESTful 风格的 Web 服务.总体目标是使客户端和文件系统作为服务器以同样的速度来更新.文件的方法,参数和模型紧密集 ...
- 黄聪:PHP页面跳转如何实现延时跳转
php在用header重定向的时候,可以设置下延时跳转,代码如下: header("Refresh:5;url=index.php");
- 详细安装ss的过程(vultr)
#更新程序yum update -y #安装setuptoolsyum install -y python-setuptools #安装pipeasy_install pip #安装shadowsoc ...
- JS运动从入门到精髓!哈哈
首先来看最基础的运动:单个物体向右匀速运动到某一点停止 例子:一个按钮,一个div,点击按钮,让div向右运动到某一个位置暂停 // 原理: 1 获取物体当前的位置 oDiv.offsetl ...
- oracle两列相同的去重
源地址:https://zhidao.baidu.com/question/66722841.html 1.不含大字段(clob等)的表格: 1 2 3 4 5 6 7 8 9 --例子表格:crea ...
- 48. Remove Duplicates from Sorted List && Remove Duplicates from Sorted List II
Remove Duplicates from Sorted List Given a sorted linked list, delete all duplicates such that each ...
- Codeforces Round #228 (Div. 1) B
B. Fox and Minimal path time limit per test 1 second memory limit per test 256 megabytes input stand ...
- VMware Workstation(虚拟机)v10.0.1 简体中文破解版
http://www.xp510.com/xiazai/ossoft/desktools/22610.html
- Statement及PreparedStatement执行多个sql
这两个对象的区别: 1.Statement它更适合执行不同sql的批处理,它没有提供预处理功能,性能比较低. 2.PreparedStatement它适合执行相同的批处理,它提供了预处理功能, ...
- oracle必须启动哪些服务?
对新手来说,要是只用Oracle自带的sql*plus的话,只要启动OracleServiceORCL即可,要是使用PL/SQL Developer等第三方工具的话,OracleOraDb11g_ho ...