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

Fix item-pipeline example #3544

merged 2 commits into from Jan 28, 2019

Conversation

@joaquingx
Copy link
Contributor

@joaquingx joaquingx commented Dec 23, 2018

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

@codecov
Copy link

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

This comment has been minimized.

@nasirhjafri

nasirhjafri Dec 28, 2018

Why not item.get('price') ?

This comment has been minimized.

@joaquingx

joaquingx Dec 28, 2018
Author Contributor

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

@dangra dangra merged commit b5026b8 into scrapy:master Jan 28, 2019
3 checks passed
3 checks passed
codecov/patch Coverage not affected when comparing 23bffff...e1f8b55
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@dangra
Copy link
Member

@dangra 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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants