Subversion Repositories SmartDukaan

Rev

Rev 14796 | Rev 14823 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
14371 kshitij.so 1
from dtr.utils import FetchLivePrices
2
from shop2020.model.v1.dtr.impl.Convertors import to_t_livePricing
3
 
4
class DtrServiceHandler:
5
    '''
6
    classdocs
7
    '''
8
 
9
    def __init__(self):
10
        '''
11
        Constructor
12
        '''
13
 
14
    def getLatestPricing(self, skuBundleId, source_id):
15
        try:
16
            pricing_info = FetchLivePrices.getLatestPrice(skuBundleId, source_id)
14435 kshitij.so 17
            if len(pricing_info) == 0:
14436 kshitij.so 18
                raise
14371 kshitij.so 19
            return [to_t_livePricing(pricing) for pricing in pricing_info]
14796 kshitij.so 20
        except Exception as e:
21
            print "Dtr handler exception ",e
14436 kshitij.so 22
            return [to_t_livePricing(pricing) for pricing in [{}]]
14822 kshitij.so 23
 
24
    def isAlive(self, ):
25
        """
26
        For checking weather service is active alive or not.
27
        """
28
        return True
14371 kshitij.so 29
 
30
if __name__ == '__main__':
14435 kshitij.so 31
    dt  = DtrServiceHandler()
32
    print dt.getLatestPricing(100, 1)