Subversion Repositories SmartDukaan

Rev

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

Rev 13828 Rev 13844
Line 35... Line 35...
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'])
38
        print url
38
        print url
39
        time.sleep(1)
39
        time.sleep(1)
-
 
40
        lowestOfferPrice = 0
-
 
41
        instock = 0
40
        req = urllib2.Request(url,headers=headers)
42
        req = urllib2.Request(url,headers=headers)
41
        response = urllib2.urlopen(req)
43
        response = urllib2.urlopen(req)
42
        json_input = response.read()
44
        json_input = response.read()
43
        vendorInfo = json.loads(json_input)
45
        if len(json_input) > 0:
44
        lowestOfferPrice = 0
46
            vendorInfo = json.loads(json_input)
45
        instock = 0
-
 
46
        for vendor in vendorInfo:
47
            for vendor in vendorInfo:
47
            lowestOfferPrice = float(vendor['sellingPrice'])
48
                lowestOfferPrice = float(vendor['sellingPrice'])
48
            stock = vendor['buyableInventory']
49
                stock = vendor['buyableInventory']
49
            if stock > 0 and lowestOfferPrice > 0:
50
                if stock > 0 and lowestOfferPrice > 0:
50
                instock = 1
51
                    instock = 1
51
                break
52
                    break
52
                
53
                    
53
        print lowestOfferPrice
54
        print lowestOfferPrice
54
        print instock
55
        print instock
55
        print stock
56
        print stock
56
        print "*************"
57
        print "*************"
57
        if instock  == 1:
58
        if instock  == 1: