Esempio n. 1
0
def parse():
    products = product_search.get_products()
    for product in products:
        try:
            if "benifits" in product:
                selector = etree.HTML(product['benifits'])
                #print selector.xpath('//ul/li/text()')
                product['benifits'] = selector.xpath('//ul/li/text()')
        except KeyError as e:
            print e
    return products
Esempio n. 2
0
def _load_product(request, selected_categories):
    """
    if products dataSet existing in session return it
    otherwise load it and store it in session
    """
    products = request.session.get('products')
    if not products:
        products = product_search.get_products(selected_categories)
        request.session['products'] = products
        request.session['product_count'] = len(products)
    return products