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

Defaults number of node children to empty list, for nodes which do no… #127

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 109 additions & 1 deletion amazon/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ def children(self):
A list of this browse node's children in the browse node tree.
"""
children = []
child_nodes = getattr(self.parsed_response, 'Children')
child_nodes = getattr(self.parsed_response, 'Children', [])
for child in getattr(child_nodes, 'BrowseNode', []):
children.append(AmazonBrowseNode(child))
return children
Expand Down Expand Up @@ -742,6 +742,114 @@ def asin(self):
"""
return self._safe_get_element_text('ASIN')

@property
def total_new(self):
"""Total offers

:return:
Total offers (integer).
"""
return self._safe_get_element_text('OfferSummary.TotalNew')

@property
def total_used(self):
"""Total used

:return:
Total used (integer).
"""
return self._safe_get_element_text('OfferSummary.TotalUsed')

@property
def total_refurbished(self):
"""Total refurbished

:return:
Total refurbished (integer).
"""
return self._safe_get_element_text('OfferSummary.TotalRefurbished')

@property
def total_collectible(self):
"""Total collectible

:return:
Total collectible (integer).
"""
return self._safe_get_element_text('OfferSummary.TotalCollectible')

@property
def item_height(self):
"""Item height

:return:
Item height (integer).
"""
return self._safe_get_element_text('ItemAttributes.ItemDimensions.Height')

@property
def item_width(self):
"""Item width

:return:
Item width (integer).
"""
return self._safe_get_element_text('ItemAttributes.ItemDimensions.Width')

@property
def item_length(self):
"""Item length

:return:
Item length (integer).
"""
return self._safe_get_element_text('ItemAttributes.ItemDimensions.Length')

@property
def item_weight(self):
"""Item weight

:return:
Item weight (integer).
"""
return self._safe_get_element_text('ItemAttributes.ItemDimensions.Weight')

@property
def package_height(self):
"""Package height

:return:
Package height (integer).
"""
return self._safe_get_element_text('ItemAttributes.PackageDimensions.Height')

@property
def package_width(self):
"""Package width

:return:
Package width (integer).
"""
return self._safe_get_element_text('ItemAttributes.PackageDimensions.Width')

@property
def package_length(self):
"""Package length

:return:
Package length (integer).
"""
return self._safe_get_element_text('ItemAttributes.PackageDimensions.Length')

@property
def package_weight(self):
"""Package weight

:return:
Package weight (integer).
"""
return self._safe_get_element_text('ItemAttributes.PackageDimensions.Weight')

@property
def sales_rank(self):
"""Sales Rank
Expand Down