I am using Boto in Python to connect to Amazon MWS. I have successfully connected using their scripts but am having trouble parsing the response as I don't fully understand the documentation, and there are little to no examples on the internet. I am new to Python.
Here is how I get my response from MWS:
mws = MWSConnection(accessKeyId,secretKey,Merchant=merchantId)
response = mws.list_matching_products(MarketplaceId=marketplaceId,Query="Beanie Babies")
The first product gives a response of this:
products = response.ListMatchingProductsResult.Products.Product
print(products[0])
>>>Product{}(Identifiers: ^Identifiers^{}(MarketplaceASIN: ^MarketplaceASIN^{}(MarketplaceId: 'ATVPDKIKX0DER', ASIN: 'B000JK67MQ'), SKUIdentifier: None), Offers: None, CompetitivePricing: [], AttributeSets: ^AttributeSets^{}(ItemAttributes: [ItemAttributes{'xml:lang': 'en-US'}(Brand: 'Beanie Babies', Studio: 'Beanie Babies - Teddy Bears', ItemDimensions: 4.00inchesx10.00inchesx6.00inchesx0.31pounds, Languages: None, Binding: 'Toy', Genre: 'cute pets', Color: 'purple', MaterialType: [], Feature: ['Ty Beanie Baby', 'Princess Bear', 'Purple with purple bow with white flower', 'Does have the tag'], ManufacturerMaximumAge: 36{'Units': 'months'}, OperatingSystem: [], Artist: [], Director: [], ProductTypeName: 'TOYS_AND_GAMES', Creator: [], Edition: '1997', Model: '4300', SmallImage: Image{}(Height: 75{'Units': 'pixels'}, Width: 75{'Units': 'pixels'}, URL: 'http://ecx.images-amazon.com/images/I/4193jH4e35L._SL75_.jpg'), GemType: [], PackageDimensions: 0.90inchesx7.40inchesx4.50inchesx0.40pounds, PackageQuantity: '1', ListPrice: None, Actor: [], Platform: [], Manufacturer: 'Beanie Babies - Teddy Bears', PartNumber: '4300', ProductGroup: 'Toy', MediaType: [], IsMemorabilia: 'false', Label: 'Beanie Babies - Teddy Bears', ManufacturerMinimumAge: 36{'Units': 'months'}, IsAutographed: 'false', IsAdultProduct: 'false', Author: [], Format: [], Title: 'Ty Beanie Babies - Princess Bear', Publisher: 'Beanie Babies - Teddy Bears')]), LowestOfferListings: None, Relationships: ^Relationships^{}(VariationParent: []), SalesRankings: ^SalesRankings^{}(SalesRank: [SalesRank{}(Rank: '60161', ProductCategoryId: 'toy_display_on_website'), SalesRank{}(Rank: '1197', ProductCategoryId: '251943011'), SalesRank{}(Rank: '1609', ProductCategoryId: '11350120011')]))
My Issue is trying to get the details from the ItemAttributes:
Attributes = products[0].AttributeSets.ItemAttributes
print(Attributes[0])
>>>ItemAttributes{'xml:lang': 'en-US'}(Brand: 'Beanie Babies', Studio: 'Beanie Babies - Teddy Bears', ItemDimensions: 4.00inchesx10.00inchesx6.00inchesx0.31pounds, Languages: None, Binding: 'Toy', Genre: 'cute pets', Color: 'purple', MaterialType: [], Feature: ['Ty Beanie Baby', 'Princess Bear', 'Purple with purple bow with white flower', 'Does have the tag'], ManufacturerMaximumAge: 36{'Units': 'months'}, OperatingSystem: [], Artist: [], Director: [], ProductTypeName: 'TOYS_AND_GAMES', Creator: [], Edition: '1997', Model: '4300', SmallImage: Image{}(Height: 75{'Units': 'pixels'}, Width: 75{'Units': 'pixels'}, URL: 'http://ecx.images-amazon.com/images/I/4193jH4e35L._SL75_.jpg'), GemType: [], PackageDimensions: 0.90inchesx7.40inchesx4.50inchesx0.40pounds, PackageQuantity: '1', ListPrice: None, Actor: [], Platform: [], Manufacturer: 'Beanie Babies - Teddy Bears', PartNumber: '4300', ProductGroup: 'Toy', MediaType: [], IsMemorabilia: 'false', Label: 'Beanie Babies - Teddy Bears', ManufacturerMinimumAge: 36{'Units': 'months'}, IsAutographed: 'false', IsAdultProduct: 'false', Author: [], Format: [], Title: 'Ty Beanie Babies - Princess Bear', Publisher: 'Beanie Babies - Teddy Bears')
At this point I believe it is a dictionary object.
print(Attributes[0].values())
>>>dict_values(['en-US'])
As I am new to this language I can't figure out how to get all the information that is located in the () such as Brand, Studio, etc.
Boto has some built in functions such as Response and ResponseFactory, but I am lost again as I keep hitting a wall trying to get info such as Brand, etc..
Thank you again for any help you can give in this.