Subversion Repositories SmartDukaan

Rev

Rev 4198 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4198 varun.gupt 1
'''
2
Created on 05-Dec-2011
3
 
4
@author: varungupta
5
'''
6
import json
7
 
8
class ScrapedDataManager:
9
 
10
    def __init__(self):
5761 amar.kumar 11
        self.price_data_file = '/usr/price-comp-dashboard/primary-crawl.json'
4198 varun.gupt 12
        self.price_data = []
13
 
14
    def save(self, price_data):
15
        self.price_data.extend(price_data)
16
 
17
    def persist(self):
18
        price_data_fp = open(self.price_data_file, 'w')
19
        json.dump(self.price_data, price_data_fp, indent = 4)
20
 
21
    def dump(self):
22
        print 'Total products crawled:', len(self.price_data)
23
 
24
        for data in self.price_data:
25
            print data