python 2.7 - How to pass system command line arguments to the Scrapy CrawlerProcess? -


i have single scrapy spider pass system arguments using scrapy crawl command. trying run spider using crawlerprocess instead of command line. how can pass same command line arguments crawler process ? scrapy crawl example -o data.jl -t jsonlines -s jobdir=/crawlstate

from scrapy.crawler import crawlerprocess scrapy.utils.project import get_project_settings process = crawlerprocess(get_project_settings()) process.crawl(#how pass arguments -o data.jl -t jsonlines -s  jobdir=/crawlstate here?) process.start() 

you can modify project settings before pass them crawlerprocess constructor:

... settings = get_project_settings() settings.set('feed_uri', 'data.jl', priority='cmdline') settings.set('feed_format', 'jsonlines', priority='cmdline') settings.set('jobdir', '/crawlstate', priority='cmdline') process = crawlerprocess(settings) ... 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -