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

product.images module returns empty list

Open gerimo opened this issue 7 years ago • 2 comments

Empty image list:

product = amazon.lookup(ItemId="B006OVWT08")
return product.images 

Returns: [, , , , , ]

gerimo avatar Mar 22 '18 11:03 gerimo

Hi @gerimo, It seems to work for me it returns a list of object and you can access each object's elements

product = amazon.lookup(ItemId="B006OVWT08")
    images = product.images
    for image in images:
        print ("\nImage Object:\n%s" %(image.__dict__))
        print("Medium Image URL: %s" %(image.MediumImage.URL))

Will produce the following ` Image Object: {'SwatchImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}SwatchImage at 0x1072d3088>, 'SmallImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}SmallImage at 0x1072d30c8>, 'ThumbnailImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}ThumbnailImage at 0x1072d3148>, 'TinyImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}TinyImage at 0x1072d31c8>, 'MediumImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}MediumImage at 0x1072d3248>, 'LargeImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}LargeImage at 0x1072d32c8>, 'HiResImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}HiResImage at 0x1072d3348>} Medium Image URL: https://images-na.ssl-images-amazon.com/images/I/41kRMPzeRjL.SL160.jpg

Image Object: {'SwatchImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}SwatchImage at 0x1072d33c8>, 'SmallImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}SmallImage at 0x1072d3348>, 'ThumbnailImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}ThumbnailImage at 0x1072d3388>, 'TinyImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}TinyImage at 0x1072d3308>, 'MediumImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}MediumImage at 0x1072d3288>, 'LargeImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}LargeImage at 0x1072d3208>} Medium Image URL: https://images-na.ssl-images-amazon.com/images/I/4144aRNhG2L.SL160.jpg

Image Object: {'SwatchImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}SwatchImage at 0x1072d3188>, 'SmallImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}SmallImage at 0x1072d3208>, 'ThumbnailImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}ThumbnailImage at 0x1072d30c8>, 'TinyImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}TinyImage at 0x1072d3148>, 'MediumImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}MediumImage at 0x1072d31c8>, 'LargeImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}LargeImage at 0x1072d3248>, 'HiResImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}HiResImage at 0x1072d32c8>} Medium Image URL: https://images-na.ssl-images-amazon.com/images/I/51-FBfkDcbL.SL160.jpg

Image Object: {'SwatchImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}SwatchImage at 0x1072d3108>, 'SmallImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}SmallImage at 0x1072d32c8>, 'ThumbnailImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}ThumbnailImage at 0x1072d3088>, 'TinyImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}TinyImage at 0x1072d33c8>, 'MediumImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}MediumImage at 0x1072d3348>, 'LargeImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}LargeImage at 0x1072d3388>, 'HiResImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}HiResImage at 0x1072d3308>} Medium Image URL: https://images-na.ssl-images-amazon.com/images/I/51UIpD-R0lL.SL160.jpg

Image Object: {'SwatchImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}SwatchImage at 0x1072d3288>, 'SmallImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}SmallImage at 0x1072d3308>, 'ThumbnailImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}ThumbnailImage at 0x1072d3188>, 'TinyImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}TinyImage at 0x1072d3208>, 'MediumImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}MediumImage at 0x1072d30c8>, 'LargeImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}LargeImage at 0x1072d3148>} Medium Image URL: https://images-na.ssl-images-amazon.com/images/I/41zi8B17qSL.SL160.jpg

Image Object: {'SwatchImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}SwatchImage at 0x1072d31c8>, 'SmallImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}SmallImage at 0x1072d3148>, 'ThumbnailImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}ThumbnailImage at 0x1072d32c8>, 'TinyImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}TinyImage at 0x1072d3088>, 'MediumImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}MediumImage at 0x1072d33c8>, 'LargeImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}LargeImage at 0x1072d3348>, 'HiResImage': <Element {http://webservices.amazon.com/AWSECommerceService/2013-08-01}HiResImage at 0x1072d3388>} Medium Image URL: https://images-na.ssl-images-amazon.com/images/I/51spMo8afQL.SL160.jpg `

ilyaresh avatar Apr 19 '18 13:04 ilyaresh

@ilyaresh Perfect!

gerimo avatar Apr 19 '18 13:04 gerimo