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

Accessing returned values for Item and Package Dimensions

Open JasonCrowe opened this issue 7 years ago • 1 comments

The following information is returned by Bottlenose. How can I access it? <ItemDimensions> <Height Units="hundredths-inches">1350</Height> <Length Units="hundredths-inches">1130</Length> <Weight Units="hundredths-pounds">990</Weight> <Width Units="hundredths-inches">750</Width> </ItemDimensions>

<PackageDimensions> <Height Units="hundredths-inches"> 1098 </Height> <Length Units="hundredths-inches"> 1701 </Length> <Weight Units="hundredths-pounds"> 1280 </Weight> <Width Units="hundredths-inches"> 1449 </Width> </PackageDimensions>

JasonCrowe avatar Sep 29 '17 14:09 JasonCrowe

Hi @JasonCrowe You can use _safe_get_element() function

 print("Height:" + str(product._safe_get_element("ItemAttributes.ItemDimensions.Height")))

Will print

Height:400

ilyaresh avatar Apr 19 '18 13:04 ilyaresh