dasifo/scrapme/runner.py
def list_of_products(link="https://www.cora.fr/faire_mes_courses/animaux/chats/hygienesoin_et_accessoires_chat-c-176673", max_pages=None, only_priced=True):
    """
    we will ieterate all paginated pages that lists our products.
    :param link: url to be requested with HTTP (GET method)
    :param max_pages: limit the number of html pages to look at
    :param only_priced: True, False, None
        if True, we will only extract the products with a price.
        if False, extract the products which haven't a price.
        else, we return all the list of products.
    :return: a list of dicts, each dict represents a product described by : name, price, image
    """
    all_products = []
    i = 1
    if not isinstance(max_pages, int):
        # just trying to limit the number of html pages to look at
        max_pages = i
    while i!=0 and i <= max_pages: # ?? we can add a param to satisfy the limit number of paginations
        products = get_products(link+"?pageindex="+str(i), only_priced=only_priced)
        i += 1
        if any(products):
            all_products += products
        else:
            i == 0 # to exit the while loop because there are no products anymore
    return all_products

    we will ieterate all paginated pages that lists our products.
    :param link: url to be requested with HTTP (GET method)
    :param max_pages: limit the number of html pages to look at
    :param only_priced: True, False, None
        if True, we will only extract the products with a price.
        if False, extract the products which haven't a price.
        else, we return all the list of products.
    :return: a list of dicts, each dict represents a product described by : name, price, image
    
we will ieterate all paginated pages that lists our products.
we will ieterate all paginated pages that lists our products .
def list_of_products(link="https://www.cora.fr/faire_mes_courses/animaux/chats/hygienesoin_et_accessoires_chat-c-176673", max_pages=None, only_priced=True):
    all_products = []
    i = 1
    if not isinstance(max_pages, int):
        max_pages = i
    while i!=0 and i <= max_pages: 
        products = get_products(link+"?pageindex="+str(i), only_priced=only_priced)
        i += 1
        if any(products):
            all_products += products
        else:
            i == 0 
    return all_products
def list_of_products ( link = "https://www.cora.fr/faire_mes_courses/animaux/chats/hygienesoin_et_accessoires_chat-c-176673" , max_pages = None , only_priced = True ) : all_products = [ ] i = 1 if not isinstance ( max_pages , int ) : max_pages = i while i != 0 and i <= max_pages : products = get_products ( link + "?pageindex=" + str ( i ) , only_priced = only_priced ) i += 1 if any ( products ) : all_products += products else : i == 0 return all_products
we will ieterate all paginated pages that lists our products.
we will ieterate all paginated pages that lists our products .
"""
    we will ieterate all paginated pages that lists our products.
    :param link: url to be requested with HTTP (GET method)
    :param max_pages: limit the number of html pages to look at
    :param only_priced: True, False, None
        if True, we will only extract the products with a price.
        if False, extract the products which haven't a price.
        else, we return all the list of products.
    :return: a list of dicts, each dict represents a product described by : name, price, image
    """ # just trying to limit the number of html pages to look at # ?? we can add a param to satisfy the limit number of paginations # to exit the while loop because there are no products anymore
a list of dicts, each dict represents a product described by : name, price, image
a list of dicts each dict represents a product described by : name price image
link
url to be requested with HTTP (GET method)
url to be requested with HTTP ( GET method )
max_pages
limit the number of html pages to look at
limit the number of html pages to look at
only_priced
True, False, None
if True, we will only extract the products with a price.
if False, extract the products which haven't a price.
else, we return all the list of products.
True False None if True we will only extract the products with a price . if False extract the products which haven ' t a price . else we return all the list of products .