Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix item-pipeline example #3544

Merged
merged 2 commits into from Jan 28, 2019
Merged

Conversation

joaquingx
Copy link
Contributor

if item['price']: and if item['price_excludes_vat']: could return KeyError exception, this patch aims to solve it.

@codecov
Copy link

codecov bot commented Dec 23, 2018

Codecov Report

Merging #3544 into master will increase coverage by 0.1%.
The diff coverage is n/a.

@@            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
Impacted Files Coverage Δ
scrapy/core/downloader/handlers/http10.py 100% <0%> (ø) ⬆️
scrapy/commands/shell.py 92.85% <0%> (ø) ⬆️
scrapy/core/downloader/handlers/file.py 100% <0%> (ø) ⬆️
scrapy/settings/default_settings.py 98.63% <0%> (+0.01%) ⬆️
scrapy/core/downloader/handlers/http11.py 92.53% <0%> (+0.02%) ⬆️
scrapy/core/downloader/handlers/ftp.py 98.24% <0%> (+0.03%) ⬆️
scrapy/core/downloader/handlers/datauri.py 93.75% <0%> (+0.41%) ⬆️
scrapy/core/downloader/handlers/__init__.py 83.63% <0%> (+3.63%) ⬆️
scrapy/spiders/sitemap.py 81.25% <0%> (+6.25%) ⬆️
scrapy/extensions/telnet.py 80.95% <0%> (+6.95%) ⬆️

@@ -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']:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not item.get('price') ?

Copy link
Contributor Author

@joaquingx joaquingx Dec 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I'll change it. Changed 👌

@dangra dangra merged commit b5026b8 into scrapy:master Jan 28, 2019
@dangra
Copy link
Member

dangra commented Jan 28, 2019

thanks

@kmike kmike added this to the v1.6 milestone Jan 29, 2019
@kmike kmike added the docs label Jan 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants