Subversion Repositories SmartDukaan

Rev

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

'''
Created on 05-Dec-2011

@author: varungupta
'''
import json

class ScrapedDataManager:
    
    def __init__(self):
        self.price_data_file = '/usr/price-comp-dashboard/primary-crawl.json'
        self.price_data = []
    
    def save(self, price_data):
        self.price_data.extend(price_data)
    
    def persist(self):
        price_data_fp = open(self.price_data_file, 'w')
        json.dump(self.price_data, price_data_fp, indent = 4)
    
    def dump(self):
        print 'Total products crawled:', len(self.price_data)
        
        for data in self.price_data:
            print data