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的更多相关文章

  1. Memcached source code analysis (threading model)--reference

    Look under the start memcahced threading process memcached multi-threaded mainly by instantiating mu ...

  2. 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 ...

  3. 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 ...

  4. Apache Commons Pool2 源码分析 | Apache Commons Pool2 Source Code Analysis

    Apache Commons Pool实现了对象池的功能.定义了对象的生成.销毁.激活.钝化等操作及其状态转换,并提供几个默认的对象池实现.在讲述其实现原理前,先提一下其中有几个重要的对象: Pool ...

  5. Redis source code analysis

    http://zhangtielei.com/posts/blog-redis-dict.html http://zhangtielei.com/assets/photos_redis/redis_d ...

  6. linux kernel & source code analysis& hacking

    https://kernelnewbies.org/ http://www.tldp.org/LDP/lki/index.html https://kernelnewbies.org/ML https ...

  7. 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 ...

  8. 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- ...

  9. Top 40 Static Code Analysis Tools

    https://www.softwaretestinghelp.com/tools/top-40-static-code-analysis-tools/ In this article, I have ...

  10. 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 ...

随机推荐

  1. C# : Post 接收或发送XML

    项目分成两个 web(ASP.Net)用户处理请求,客户端(wpf/winform)发送请求 1.web项目 有两个页面 SendPost.aspx(单纯发送数据给客户端) 代码: public pa ...

  2. fastboot 重启到recovery

    要使用adb命令,手机需要打开USB debug. 安装软件 adb install apk文件名称.apk 重新安装该软件 adb install -r apk文件名称.apk 卸载apk软件 ad ...

  3. Oracle导入和导出

    导出:EXP userid=<username>/<password>@<service_name> file=<dmpname> e.g.exp sa ...

  4. Storm Ack框架笔记

    Storm利用Acker Bolt节点跟踪消息,当Spout发送出去的消息以及这些消息所衍生出来的消息均被处理后,Spout将受到对应于该消息的Ack.实现要点: 1.Storm中每条发送出去的消息都 ...

  5. java程序打包成jar 配置文件信息路径

    一个普通的java project,里面引用了config.properties配置文件,将项目打成Runnable jar,然后将config.properties放到打包后的jar路径下,执行该j ...

  6. 在.NET中使用EPPlus生成Excel报表 .

    --摘抄自:http://blog.csdn.net/zhoufoxcn/article/details/14112473 在开发.NET应用中可能会遇到需要生成带图表(Chart)的Excel报表的 ...

  7. 注册页面JS前台校验

    运行效果图: HTML代码: <script> function checkForm(){ //校验用户名 //获得用户名文本框的值 var username=document.getEl ...

  8. JSP+Servlet中使用cos.jar进行图片上传(文件上传亦然)

    链接:JSP+Servlet中使用jspsmartupload.jar进行图片上传下载 关于cos.jar,百度百科只有这么几句话(http://baike.baidu.com/subview/406 ...

  9. C++ 约瑟夫环问题

    约瑟夫环比较经典了 已知n个人(以编号1,2,3...n分别表示)围坐在一张圆桌周围.从编号为k的人开始报数,数到m的那个人出列:他的下一个人又从1开始报数,数到m的那个人又出列:依此规律重复下去,直 ...

  10. 【EF学习笔记07】----------加载关联表的数据 贪婪加载

    讲解之前,先来看一下我们的数据库结构:班级表 学生表 贪婪加载 //贪婪加载 using (var db = new Entities()) { var classes = db.Classes.Wh ...