예제 #1
0
def get_baseprice(productpage):
    # get online price
    index1 = productpage.find('$')
    index2 = productpage[index1:].find('.')
    
    price = productpage[index1:index1+index2+2]
    return clean_price(price)
예제 #2
0
def get_baseprice(price_box):
    #print price_box
    try:
        price_base = price_box.find('i').text
    except:
        ii = price_box.find('b')
        price_base = ii.text  
    
    return clean_price(price_base)
예제 #3
0
def obtain_supply(sku):
    fullproductpage = request_fullproduct_page(sku)
    
    index1 = fullproductpage.find('var DefaultItem =')
    index2 = fullproductpage[index1:].find('</script>')
    fd = fullproductpage[index1:index1+index2]    
    
    itemdict = {
        'suppliers' : 'walmart',
        'suppliers_PID' : sku,
        'local_PID' : sku,
        'itemproduct':  obtain_product(sku),
        'price_base': clean_price(extract_variables(fd,'currentItemPrice')),
        'online_avail':extract_variables(fd,'isBuyableOnWWW'),
        'local_avail':extract_variables(fd,'isBuyableInStore'), 
    }
    
    return itemdict
예제 #4
0
def obtain_supply(sku):  
    product_box = request_product_page(sku)
    inventory_box = request_inventory_page(sku)
    if len(inventory_box) == 0:
        offer_box = {'active':False,'onlineAvailability':False,'regularPrice':'0.0'}
    
    else:
        offer_box = inventory_box[0]['products'][0]
    itemdict = {
        'suppliers' : 'bestbuy',
        'suppliers_PID' : sku,
        'local_PID' : sku,
        'itemproduct':  obtain_product(sku),
        'price_base': clean_price(offer_box['regularPrice']),
        'online_avail':offer_box['active'],
        'local_avail':offer_box['onlineAvailability'] 
    }
    
    return itemdict
예제 #5
0
def get_baseprice(Offers):
    if Offers.TotalOffers.pyval != 0:
        return clean_price(Offers.Offer.OfferListing.Price.FormattedPrice.pyval)
    else:
        return None