mirror of https://github.com/scrapy/scrapy.git
add instructions about how to define output file when running scrapy from script instead of cmd
This commit is contained in:
parent
fa6a0d799b
commit
e892a484e8
|
|
@ -35,12 +35,17 @@ Here's an example showing how to run a single spider with it.
|
|||
...
|
||||
|
||||
process = CrawlerProcess({
|
||||
'USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'
|
||||
'USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)',
|
||||
'FEED_FORMAT':'json',
|
||||
'FEED_URI':'items.json'
|
||||
})
|
||||
|
||||
process.crawl(MySpider)
|
||||
process.start() # the script will block here until the crawling is finished
|
||||
|
||||
Define settings within dictionary in
|
||||
CrawlerProcess. FEED_FORMAT and FEED_URI are the equivalent to "-o items.json" when using the scrapy crawl shell command.
|
||||
|
||||
Make sure to check :class:`~scrapy.crawler.CrawlerProcess` documentation to get
|
||||
acquainted with its usage details.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue