Subversion Repositories SmartDukaan

Rev

Rev 15612 | Rev 15618 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15612 Rev 15615
Line 29... Line 29...
29
            'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',      
29
            'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',      
30
            'Accept-Language' : 'en-US,en;q=0.8',                     
30
            'Accept-Language' : 'en-US,en;q=0.8',                     
31
            'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.3'
31
            'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.3'
32
        }
32
        }
33
 
33
 
34
ignoreItems = [475,476,477,478,4490,4491,10360,10361]
34
ignoreItems = [475,476,477,478,4490,4491,10360,10361,14893, 23165, 8682]
35
 
35
 
36
def get_mongo_connection(port=27017):
36
def get_mongo_connection(port=27017):
37
    global con
37
    global con
38
    if con is None:
38
    if con is None:
39
        print "Establishing connection %s host and port %d" %(host,port)
39
        print "Establishing connection %s host and port %d" %(host,port)
Line 49... Line 49...
49
    if source_id == 1:
49
    if source_id == 1:
50
        try:
50
        try:
51
            if data['identifier'] is None or len(data['identifier'].strip())==0:
51
            if data['identifier'] is None or len(data['identifier'].strip())==0:
52
                return {}
52
                return {}
53
            
53
            
-
 
54
            if data['_id'] in ignoreItems:
-
 
55
                print "Ignored items returning for %d"%(data['_id'])
-
 
56
                return {'_id':data['_id'],'available_price':data['available_price'],'in_stock':data['in_stock'],'source_id':1,'source_product_name':data['source_product_name'],'marketPlaceUrl':data['marketPlaceUrl'],'thumbnail':data['thumbnail']}
-
 
57
            
-
 
58
            
54
            if data['dealFlag'] ==1 and data['dealType'] ==1:
59
            if data['dealFlag'] ==1 and data['dealType'] ==1:
55
                data['marketPlaceUrl'] = "http://www.amazon.in/dp/%s"%(data['identifier'].strip())
60
                data['marketPlaceUrl'] = "http://www.amazon.in/dp/%s"%(data['identifier'].strip())
56
            
61
            
57
            try:
62
            try:
58
                if ignoreLastUpdated and data['priceUpdatedOn'] > to_java_date(now - timedelta(minutes=5)):
63
                if ignoreLastUpdated and data['priceUpdatedOn'] > to_java_date(now - timedelta(minutes=5)):
Line 430... Line 435...
430
            item['manualDealThresholdPrice'] = manualDeals[0]['dealThresholdPrice']
435
            item['manualDealThresholdPrice'] = manualDeals[0]['dealThresholdPrice']
431
        info = returnLatestPrice(item, item['source_id'],False)
436
        info = returnLatestPrice(item, item['source_id'],False)
432
        print info
437
        print info
433
 
438
 
434
def main():
439
def main():
435
    print "retuned %s"%(str(getLatestPriceById(23151)))
440
    print "retuned %s"%(str(getLatestPrice(1132,1)))
436
 
441
 
437
if __name__=='__main__':
442
if __name__=='__main__':
438
    main()
443
    main()
439
    
444