예제 #1
0
    def _parse_stock_status(self, response):
        stock_value = self.STOCK_STATUS['CALL_FOR_AVAILABILITY']
        stock_status = extract_first(
            response.xpath('//span[@id="productAvailability"]/text()'))
        stock_status = stock_status.lower()

        if stock_status == 'out of stock':
            stock_value = self.STOCK_STATUS['OUT_OF_STOCK']
        elif stock_status == 'in stock':
            stock_value = self.STOCK_STATUS['IN_STOCK']
        elif stock_status == 'call for availability':
            stock_value = self.STOCK_STATUS['CALL_FOR_AVAILABILITY']
        elif stock_status == 'discontinued':
            stock_value = self.STOCK_STATUS['OTHER']
        return stock_value
예제 #2
0
    def _parse_stock_status(response):
        stock_value = 4
        stock_status = extract_first(response.xpath('//span[@id="productAvailability"]/text()'))
        stock_status = stock_status.lower()

        if stock_status == 'out of stock':
            stock_value = 0

        if stock_status == 'in stock':
            stock_value = 1

        if stock_status == 'call for availability':
            stock_value = 2

        if stock_status == 'discontinued':
            stock_value = 3

        return stock_value
    def _parse_stock_status(response):
        stock_value = 4
        stock_status = extract_first(response.xpath('//span[@id="productAvailability"]/text()'))
        stock_status = stock_status.lower()

        if stock_status == 'out of stock':
            stock_value = 0

        if stock_status == 'in stock':
            stock_value = 1

        if stock_status == 'call for availability':
            stock_value = 2

        if stock_status == 'discontinued':
            stock_value = 3

        return stock_value
예제 #4
0
 def _parse_retailer_key(self, response):
     retailer_key = extract_first(response.xpath('//span[@itemprop="sku"]/text()'))
     return clean_text(self, retailer_key)
예제 #5
0
 def _parse_sku(self, response):
     sku = extract_first(response.xpath('//span[@itemprop="sku"]/text()'))
     return clean_text(self, sku)
예제 #6
0
 def _parse_price(response):
     price = extract_first(response.xpath('//span[@class="product-price"]'
                                          '/span[@class="priceDisplay"]/text()'))
     if price:
         return float(price.replace("$", "").replace(",", ""))
예제 #7
0
 def _parse_model(self, response):
     model = extract_first(response.xpath('//span[@itemprop="mpn"]/text()'))
     return clean_text(self, model)
예제 #8
0
 def _parse_image(response):
     image_url = extract_first(response.xpath('//a[@item-prop="image"]/@href'))
     return image_url
예제 #9
0
 def _parse_brand(self, response):
     brand = response.xpath('//span[@itemprop="brand"]/text()')
     if brand:
         return extract_first(brand)
     return self.searchterm.upper()
 def _parse_image(response):
     image_url = extract_first(response.xpath('//a[@item-prop="image"]/@href'))
     return image_url
 def _parse_name(response):
     name = extract_first(response.xpath('//h1[@class="pagetitle"]/text()'))
     return name
 def _parse_shippingphrase(response):
     shipping_phrase = extract_first(response.xpath('//span[@id="productEstimatedShipping"]/text()'))
     return shipping_phrase
 def _parse_retailer_key(self, response):
     retailer_key = extract_first(response.xpath('//span[@itemprop="sku"]/text()'))
     return clean_text(self, retailer_key)
 def _parse_sku(self, response):
     sku = extract_first(response.xpath('//span[@itemprop="sku"]/text()'))
     return clean_text(self, sku)
 def _parse_price(response):
     price = extract_first(response.xpath('//span[@class="product-price"]'
                                          '/span[@class="priceDisplay"]/text()'))
     if price:
         return float(price.replace("$", "").replace(",", ""))
 def _parse_model(self, response):
     model = extract_first(response.xpath('//span[@itemprop="mpn"]/text()'))
     return clean_text(self, model)
예제 #17
0
 def _parse_shippingphrase(response):
     shipping_phrase = extract_first(response.xpath('//span[@id="productEstimatedShipping"]/text()'))
     return shipping_phrase
예제 #18
0
 def _parse_name(response):
     name = extract_first(response.xpath('//h1[@class="pagetitle"]/text()'))
     return name
 def _parse_brand(self, response):
     brand = response.xpath('//span[@itemprop="brand"]/text()')
     if brand:
         return extract_first(brand)
     return 'HP'