Subversion Repositories SmartDukaan

Rev

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

Rev 13847 Rev 13877
Line 32... Line 32...
32
    for data in snapdealBestSellers:
32
    for data in snapdealBestSellers:
33
        print data['identifier']
33
        print data['identifier']
34
        if data['identifier'] is None or len(data['identifier'].strip())==0:
34
        if data['identifier'] is None or len(data['identifier'].strip())==0:
35
            print "continue"
35
            print "continue"
36
            continue
36
            continue
37
        url="http://www.snapdeal.com/acors/json/gvbps?supc=%s&catId=175&sort=sellingPrice"%(data['identifier'])
37
        url="http://www.snapdeal.com/acors/json/gvbps?supc=%s&catId=175&sort=sellingPrice"%(data['identifier'].strip())
38
        print url
38
        print url
39
        time.sleep(1)
39
        time.sleep(1)
40
        lowestOfferPrice = 0
40
        lowestOfferPrice = 0
41
        instock = 0
41
        instock = 0
42
        req = urllib2.Request(url,headers=headers)
42
        req = urllib2.Request(url,headers=headers)
Line 54... Line 54...
54
        print lowestOfferPrice
54
        print lowestOfferPrice
55
        print instock
55
        print instock
56
        print stock
56
        print stock
57
        print "*************"
57
        print "*************"
58
        if instock  == 1:
58
        if instock  == 1:
59
            get_mongo_connection().Catalog.MasterData.update({'identifier':data['identifier'].strip()}, {'$set' : {'available_price':lowestOfferPrice,'updatedOn':to_java_date(now),'in_stock':instock}}, multi=True)
59
            get_mongo_connection().Catalog.MasterData.update({'identifier':data['identifier'].strip(),'source_id':3}, {'$set' : {'available_price':lowestOfferPrice,'updatedOn':to_java_date(now),'in_stock':instock}}, multi=True)
60
        else:
60
        else:
61
            get_mongo_connection().Catalog.MasterData.update({'identifier':data['identifier'].strip()}, {'$set' : {'updatedOn':to_java_date(now),'in_stock':instock}}, multi=True)
61
            get_mongo_connection().Catalog.MasterData.update({'identifier':data['identifier'].strip(),'source_id':3}, {'$set' : {'updatedOn':to_java_date(now),'in_stock':instock}}, multi=True)
62
 
62
 
63
def main():
63
def main():
64
    updatePrices()
64
    updatePrices()
65
 
65
 
66
if __name__=='__main__':
66
if __name__=='__main__':