简体   繁体   English

Scrapy-从python脚本运行蜘蛛

[英]Scrapy - running spider from a python script

I am trying to run scrapy from a python script according to documentation http://scrapy.readthedocs.io/en/0.16/topics/practices.html 我正在尝试根据文档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

but when I run it, I get the following error: 但是当我运行它时,出现以下错误:

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

has something been deprecated? 有什么不推荐的东西吗? what is wrong here? 这是怎么了

my version is Scrapy 1.1.2 我的版本是Scrapy 1.1.2

You are looking at Scrapy 0.16 docs but using Scrapy 1.1.2. 您正在查看Scrapy 0.16文档,但使用的是Scrapy 1.1.2。

Here is the correct documentation page . 这是正确的文档页面

FYI, you should now be using CrawlerProcess or CrawlerRunner . 仅供参考,您现在应该使用CrawlerProcessCrawlerRunner

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

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