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 ...
随机推荐
- Tcpdump非常实用的抓包12实例
1.过滤主机---------------------------------------------------------------- - 抓取所有经过 eth1,目的或源地址是 192.168 ...
- activiti自定义流程之整合(五):启动流程时获取自定义表单
流程定义部署之后,自然就是流程定义列表了,但和前一节一样的是,这里也是和之前单独的activiti没什么区别,因此也不多说.我们先看看列表页面以及对应的代码,然后在一步步说明点击启动按钮时如何调用自定 ...
- Crt单元
一.调用单元例:uses crt; 二.清屏例:clrscr; 三.移动光标例:gotoxy(a,b);其中a表示列号,b表示行号 四.清行例:clreol;清除光标所在行光标上及以后的所有字符 五. ...
- 【knowledgebase】不要在一个很大的RDD上调用collect
如果一个RDD很大以至于它的所有元素并不能在driver端机器的内存中存放下,请不要进行如下调用: val values = myVeryLargeRDD.collect() collect将尝试 ...
- 2017/1/8 C语言程序练习d
有10个数按由小到大顺序存放在一个数组中,输入一个数,要求用折半查找法找出该数是数组中第几个元素的值.如果该数不在数组中,则打印出"无此数". 输入:-12 -8 12 24 45 ...
- iOS开发中的4种数据持久化方式【二、数据库 SQLite3、Core Data 的运用】
在上文,我们介绍了ios开发中的其中2种数据持久化方式:属性列表.归档解档.本节将继续介绍另外2种iOS持久化数据的方法:数据库 SQLite3.Core Data 的运 ...
- ORACLE 常用函数 日期/时间函数
---------------------------------------------日期/时间函数----------------------------------------------- ...
- php六种基础算法:冒泡,选择,插入,快速,归并和希尔排序法
$arr(1,43,54,62,21,66,32,78,36,76,39); 1. 冒泡排序法 * 思路分析:法如其名,就是像冒泡一样,每次从数组当中 冒一个最大的数出来. * 比 ...
- canvas画随机闪烁的星星
canvas画一颗星星: 规则的星星有内切圆和外切圆,每两个点之间的角度是固定的,因此可得到星星的每个点的坐标,画出星星. function drawStars(x,y,radius1,radius2 ...
- 自己练习读取写入txt
读取文件中的内容生成一个list,然后修改list后再写会该文件文件中的格式是:AA,BB,CC,DDblist = []for line in open('a.txt'): blist.extend ...