Fix item-pipeline example #3544
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3544 +/- ##
=========================================
+ Coverage 84.38% 84.48% +0.1%
=========================================
Files 167 167
Lines 9376 9405 +29
Branches 1392 1397 +5
=========================================
+ Hits 7912 7946 +34
+ Misses 1206 1201 -5
Partials 258 258
|
docs/topics/item-pipeline.rst
Outdated
@@ -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']: |
nasirhjafri
Dec 28, 2018
Why not item.get('price')
?
Why not item.get('price')
?
joaquingx
Dec 28, 2018
•
Author
Contributor
You're right, I'll change it. Changed 👌
You're right, I'll change it. Changed
thanks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
if item['price']:
andif item['price_excludes_vat']:
could returnKeyError
exception, this patch aims to solve it.