Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Update item-pipeline example

Joaquin Garmendia Cabreraf85c915872cf
diff --git a/docs/topics/item-pipeline.rst b/docs/topics/item-pipeline.rst
index 38265b474..1c2c51e05 100644
--- a/docs/topics/item-pipeline.rst
+++ b/docs/topics/item-pipeline.rst
@@ -87,8 +87,8 @@ contain a price::
vat_factor = 1.15
def process_item(self, item, spider):
- if item['price']:
- if item['price_excludes_vat']:
+ if 'price' in item and item['price']:
+ if 'price_excludes_vat' in item and item['price_excludes_vat']:
item['price'] = item['price'] * self.vat_factor
return item
else: