繁体   English   中英

Scrapy-从python脚本运行蜘蛛

[英]Scrapy - running spider from a python script

我正在尝试根据文档http://scrapy.readthedocs.io/en/0.16/topics/practices.htmlpython脚本运行scrapy

def CrawlTest():

    spider = PitchforkSpider(domain='"pitchfork.com"')
    crawler = Crawler(Settings())
    crawler.configure()
    crawler.crawl(spider)
    crawler.start()
    log.start()
    reactor.run() # the script will block here

但是当我运行它时,出现以下错误:

AttributeError: 'Settings' object has no attribute 'update_settings'

有什么不推荐的东西吗? 这是怎么了

我的版本是Scrapy 1.1.2

您正在查看Scrapy 0.16文档,但使用的是Scrapy 1.1.2。

这是正确的文档页面

仅供参考,您现在应该使用CrawlerProcessCrawlerRunner

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM