01-pycharm调试scrapy执行流程

1.pypi install -i https://pypi.douban.com/simple pypiwin32  scrapy crawl jobbole

2. ArticleSpider/ArticleSpider/spiders/jobbole.py中,  def pass(self, response)断点,

3.根目录ArticleSpider中新建main.py文件,代码如下

import sys, os
from scrapy.cmdline import execute


sys.path.append(os.path.dirname(os.path.abspath(__file__)))
execute(['scrapy', 'crawl', 'jobbole'])

4. debug main.py文件, 查看jobbole.py 中 def pass函数返回的response

 

5.settings.py中

ROBOTSTXT_OBEY =  False

 

posted @ 2018-01-04 14:18  贾梦阳1024  阅读(357)  评论(0编辑  收藏  举报