python-amazon-simple-product-api icon indicating copy to clipboard operation
python-amazon-simple-product-api copied to clipboard

Added support for AternateVersions Response group

Open ThomasProctor opened this issue 6 years ago • 2 comments

Adds support for another response group. Part of the long slog to add support for #60.

I modeled this on how we support the "Images" response group. I'm not sure if it's the right way to do it, but I figured I should be consistent with the current API.

Here's some example usage:

In [11]: lookup_result = amazon.lookup(ItemId="1491914254", ResponseGroup='AlternateVersions')

In [12]: lookup_result.alternate_versions
Out[12]: 
[{'asin': '9352136047',
  'binding': 'Paperback',
  'title': "Deep Learning: A Practitioner's Approach"},
 {'asin': 'B074D5YF1D',
  'binding': 'Kindle Edition',
  'title': "Deep Learning: A Practitioner's Approach"}]

ThomasProctor avatar Mar 28 '18 23:03 ThomasProctor

Some tests fail, as it looks like some of the info on products they query has changed. I opened an issue #134. All product-specific information should probably be removed from the tests. Instead, tests should just do type checks and check that the product information is present, and ignore what the specific value of that product information is.

ThomasProctor avatar Mar 28 '18 23:03 ThomasProctor

Sorry about not opening a separate branch - I fixed an error in how browse_node_lookup handles invalid BrowseNodeIds. It turns out that the IsValid parameter does not, in fact, tell if the browse node id is valid. Instead, I had it check to see if any errors are made by the request. This was the bug highlighted by Issue #113.

Some pep8 white space changes in the test file got put in as well.

ThomasProctor avatar Mar 29 '18 15:03 ThomasProctor