简体   繁体   中英

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

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

You are looking at Scrapy 0.16 docs but using Scrapy 1.1.2.

Here is the correct documentation page .

FYI, you should now be using CrawlerProcess or CrawlerRunner .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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