def extract_skus(self, response): skus = {} common_sku = extract_price_details(self.extract_price_text(response)) sizes = response.css('.swatches.size .emptyswatch a::text').extract() colours = response.css('.swatches.color a::text').extract() for size in sizes: for colour in colours: sku = common_sku.copy() sku['colour'] = colour.strip() sku['size'] = size.strip() skus[f"{sku['colour']}_{sku['size']}"] = sku return skus
def extract_skus(self, response): skus = [] common_sku = extract_price_details(self.extract_price(response)) raw_skus = self.extract_raw_skus(response) common_sku['colour'] = raw_skus['93']['options'][0]['label'] for raw_sku in raw_skus['243']['options']: sku = common_sku.copy() sku['size'] = raw_sku['label'] sku['sku_id'] = f"{common_sku['colour']}_{raw_sku['label']}" if not raw_sku['products']: sku['out_of_stock'] = True skus.append(sku) return skus
def extract_skus(self, response): skus = {} common_sku = extract_price_details(self.extract_price(response)) common_sku['colour'] = self.extract_colour(response) for raw_sku in self.extract_raw_skus(response): sku = common_sku.copy() sku['size'] = raw_sku['label'] stock = raw_sku['saldo'] if not stock or stock[0]['quantityAvailable'] < 1: sku['out_of_stock'] = True skus[f"{common_sku['colour']}_{sku['size']}"] = sku return skus
def extract_skus(self, response): skus = {} raw_skus = self.extract_raw_skus(response) if not raw_skus: return skus common_sku = extract_price_details(self.extract_price(response)) common_sku['colour'] = self.extract_colour(response) for raw_sku in raw_skus: sku = common_sku.copy() sku['id'] = raw_skus[raw_sku]['id'] sku['size'] = raw_skus[raw_sku]['name'] skus[f"{sku['colour']}_{sku['size']}"] = sku return skus
def extract_skus(self, response): skus = {} common_sku = extract_price_details(self.extract_price(response)) raw_skus = self.extract_raw_skus(response) for raw_sku in raw_skus: for size in raw_sku['product_id_object_list']: sku = common_sku.copy() sku['colour'] = raw_sku['color'] sku['size'] = size['label_instance'] if size['availability'] != 'in stock': sku['out_of_stock'] = True skus[f"{sku['colour']}_{sku['size']}"] = sku return skus
def extract_skus(self, raw_product, response): skus = {} common_sku = extract_price_details(self.extract_price(response)) common_sku['colour'] = self.extract_colour(raw_product) sizes = self.extract_all_sizes(response) available_sizes = self.extract_available_sizes(response) for size in sizes: sku = common_sku.copy() sku['size'] = size if size not in available_sizes: sku['out_of_stock'] = True skus[f"{sku['colour']}_{sku['size']}"] = sku return skus