akaszynski / keepa

Python Keepa.com API
https://keepaapi.readthedocs.io/en/latest/
Apache License 2.0
241 stars 77 forks source link

KeyError: 'NEW' #105

Closed KTACQU closed 3 years ago

KTACQU commented 3 years ago

Error is returned on occasion and not sure why? Sometimes runs smoothly - cant pinpoint issue other than server failure? Is there a fix for this?

price = products[i]['data']['NEW'] KeyError: 'NEW'

dehidehidehi commented 3 years ago

I suspect this happens because Keepa does not have any data concerning new condition prices for this product. A fix would be to use: price = products[i]['data'].get('NEW', list())

KTACQU commented 3 years ago

Hmmm, solution worked, but issue can arise at any moment, even directly after a successful pull of NEW prices

KTACQU commented 3 years ago

Ill close this issue, I guess for future fixes -- something to reference