Example #1
0
def get_sizes(offer):
    div = offer.find("div", {"class": "more"})
    li = div.findAll("li")
    sizes = [list_item.attrs["data-sizeeu"] for list_item in li]
    db_sizes = []
    for s in sizes:
        db_sizes.append('eu' + format_size_number(s))
    return db_sizes
def get_sizes(page, brand):
    lis = page.find_all('li', class_=re.compile('tooltip sizeButtonli ?$'))
    db_sizes = []
    for li in lis:
        s = li.a.text
        from_parentheses = s[s.find("(")+1:s.find(")")]
        db_sizes.append('eu' + format_size_number(from_parentheses))
    return db_sizes
Example #3
0
def get_sizes(offer):
    div = offer.find(attrs={"class": "m-productsBox_variantSizes js-variant_size is-active"})
    try:
        spans = div.findAll("span")
    except AttributeError:
        return []

    sizes = []
    for val in (span.text for span in spans):
        sizes.append('eu' + format_size_number(val))
    return sizes
Example #4
0
def get_sizes(offer):
    span = offer.find("span", {"class": "variants"})
    trash, sizes = span.text.split(":", 1)
    sizes = sizes.split(";")
    db_sizes = []
    for s in sizes:
        try:
            db_sizes.append('eu' + format_size_number(s))
        except ValueError:
            continue
    return db_sizes
def get_sizes(offer):
    ul = offer.find("ul", {"class": "sizeSelect dropdown-menu"})
    available = ul.findAll("a")
    sizes = []
    for a in available:
        try:
            size = re.findall(r'\[?Euro\]? (\d\d\.?\d?)', a.text)[0]
        except IndexError:
            raise ValueError(
                'Cannot extract euro size from string "{}"'.format(a.text))
        sizes.append('eu' + format_size_number(size))
    return sizes
Example #6
0
def get_sizes(size_req_json):
    if isinstance(size_req_json, str):
        size_req_json = json.loads(size_req_json)
    elif not isinstance(size_req_json, dict):
        raise TypeError('Expected "str" or "dict" type, got %r' % type(size_req_json))

    sizes = []
    try:
        for i in size_req_json['variation_list']:
            if i['availability'] > 0:
                val = i['size']
                sizes.append('eu' + format_size_number(val))
    except KeyError:
        logger.debug('Key error in sizes api %s response. Returning no sizes.')
        return []
    return sizes
Example #7
0
def get_sizes(offer):
    sizes = offer.find_class('pList__item__sizes')[0].getchildren()
    sizes = (s.text for s in sizes)
    return ['eu' + format_size_number(size) for size in sizes]
Example #8
0
def get_sizes(offer):
    sizes = offer['sizes']
    return ['eu' + format_size_number(size) for size in sizes]
Example #9
0
def get_sizes(size):
    db_sizes = []
    db_sizes.append('eu' + format_size_number(size))
    return db_sizes
Example #10
0
def get_sizes(size):
    sizes = ['eu' + format_size_number(size)]
    return sizes