Boto MWS Python Response issue

348 views Asked by At

I am trying to use Boto to read an Amazon MWS Response to get matching products for ID. I have my connection working fine, and am able to get results, but having issues trying to parse the results. It looks like Boto has built in results parsers such as Response and ResponseFactory. I just can't figure out how to transfer the information to these method so I can implement some of the pre built code.

This code:

mws = MWSConnection(accessKeyId,secretKey,Merchant=merchantId)
response = mws.list_matching_products(MarketplaceId=marketplaceId,Query="Beanie Babies")

prints out this string:

ListMatchingProductsResponse{'xmlns': 'http://mws.amazonservices.com/schema/Products/2011-10-01'}(ResponseMetadata: ^ResponseMetadata^{}(RequestId: '76d4b82c-1a03-40f5-965b-0f63e73435b5'), ListMatchingProductsResult: ListMatchingProductsResult{}(Products: ^Products^{'xmlns': 'http://mws.amazonservices.com/schema/Products/2011-10-01', 'xmlns:ns2': 'http://mws.amazonservices.com/schema/Products/2011-10-01/default.xsd'}(Product: [Product{}(Identifiers: ^Identifiers^{}(MarketplaceASIN: ^MarketplaceASIN^{}(ASIN: 'B002Q4M5PQ', MarketplaceId: 'ATVPDKIKX0DER'), SKUIdentifier: None), LowestOfferListings: None, Relationships: ^Relationships^{}(VariationParent: []), CompetitivePricing: [], AttributeSets: ^AttributeSets^{}(ItemAttributes: [ItemAttributes{'xml:lang': 'en-US'}(Publisher: 'Ty', ManufacturerMaximumAge: 144.00{'Units': 'months'}, SmallImage: Image{}(URL: 'http://ecx.images-amazon.com/images/I/412YMy2HQ0L._SL75_.jpg', Width: 56{'Units': 'pixels'}, Height: 75{'Units': 'pixels'}), Binding: 'Toy', IsAutographed: 'false', MediaType: [], IsMemorabilia: 'false', Color: 'Grey/Bluw', ManufacturerMinimumAge: 36{'Units': 'months'}, ProductGroup: 'Toy', Title: 'TY Beanie Boos - Slush - Husky', Platform: [], Artist: [], PackageQuantity: '1', ReleaseDate: '2009-11-16', Brand: 'Ty Beanie Boos', ListPrice: USD 9.99, Studio: 'Ty', Model: '36006', Format: [], NumberOfItems: '1', Author: [], Creator: [], MaterialType: ['All New Material'], Feature: ["Official product from Ty's NEW Beanie Boos Collection", "Look for the familiar heart-shaped tag that means you've purchased an authentic Ty product", 'Handmade with the finest quality standards in the industry', 'Requires no additional gift tag; inside allows you to insert "TO" and "FROM" information', 'Collect them all'], Languages: None, ItemPartNumber: '36006', IsAdultProduct: 'false', Label: 'Ty', Size: 'Small', PartNumber: '36006', PackageDimensions: 2.99inchesx6.54inchesx3.54inchesx0.22pounds, ItemDimensions: 0.13pounds, OperatingSystem: [], Actor: [], ProductTypeName: 'TOYS_AND_GAMES', Manufacturer: 'Ty', Department: 'Toys', Director: [], GemType: [])]), Offers: None, SalesRankings: ^SalesRankings^{}(SalesRank: [SalesRank{}(ProductCategoryId: 'toy_display_on_website', Rank: '1199'), SalesRank{}(ProductCategoryId: '251943011', Rank: '6'), SalesRank{}(ProductCategoryId: '11350120011', Rank: '8')])), Product{}(Identifiers: ^Identifiers^{}(MarketplaceASIN: ^MarketplaceASIN^{}(ASIN: 'B00001QEE0', MarketplaceId: 'ATVPDKIKX0DER'), SKUIdentifier: None), LowestOfferListings: None, Relationships: ^Relationships^{}(VariationParent: []), CompetitivePricing: [], AttributeSets: ^AttributeSets^{}(ItemAttributes: [ItemAttributes{'xml:lang': 'en-US'}(Binding: 'Toy', MediaType: [], ManufacturerMinimumAge: 36{'Units': 'months'}, ProductGroup: 'Toy', Genre: 'cute pets', MaterialType: [], PackageQuantity: '1', Manufacturer: 'Ty', PackageDimensions: 2.20inchesx5.80inchesx2.70inchesx0.25pounds, ListPrice: USD 9.99, Author: [], Feature: ['Ty beanie baby', 'Whisper the deer', 'Does have the tag', 'brown with white spots', 'Great condition'], Languages: None, Studio: 'Ty', IsAdultProduct: 'false', ItemDimensions: 4.00inchesx10.00inchesx6.00inchesx0.19pounds, OperatingSystem: [], Actor: [], Director: [], GemType: [], SmallImage: Image{}(URL: 'http://ecx.images-amazon.com/images/I/7109TVVS4DL._SL75_.gif', Width: 75{'Units': 'pixels'}, Height: 59{'Units': 'pixels'}), Publisher: 'Ty', ProductTypeName: 'TOYS_AND_GAMES', Platform: [], Artist: [], Brand: 'Beanie Babies', Format: [], Creator: [], Label: 'Ty', PartNumber: '4194', Title: 'TY Beanie Baby - WHISPER the Deer')]), Offers: None, SalesRankings: ^SalesRankings^{}(SalesRank: [SalesRank{}(ProductCategoryId: 'toy_display_on_website', Rank: '68255')])), Product{}(Identifiers: ^Identifiers^{}(MarketplaceASIN: ^MarketplaceASIN^{}(ASIN: 'B000JK67MQ', MarketplaceId: 'ATVPDKIKX0DER'), SKUIdentifier: None), LowestOfferListings: None, Relationships: ^Relationships^{}(VariationParent: []), CompetitivePricing: [], AttributeSets: ^AttributeSets^{}(ItemAttributes: [ItemAttributes{'xml:lang': 'en-US'}(Publisher: 'Beanie Babies - Teddy Bears', ManufacturerMaximumAge: 36{'Units': 'months'}, SmallImage: Image{}(URL: 'http://ecx.images-amazon.com/images/I/4193jH4e35L._SL75_.jpg', Width: 75{'Units': 'pixels'}, Height: 75{'Units': 'pixels'}), Title: 'Ty Beanie Babies - Princess Bear', Binding: 'Toy', IsAutographed: 'false', MediaType: [], IsMemorabilia: 'false', Color: 'purple', ManufacturerMinimumAge: 36{'Units': 'months'}, ProductGroup: 'Toy', Genre: 'cute pets', Platform: [], Artist: [], PackageQuantity: '1', Brand: 'Beanie Babies', ListPrice: None, Model: '4300', Format: [], Author: [], Creator: [], MaterialType: [], Feature: ['Ty Beanie Baby', 'Princess Bear', 'Purple with purple bow with white flower', 'Does have the tag'], Languages: None, Studio: 'Beanie Babies - Teddy Bears', IsAdultProduct: 'false', Label: 'Beanie Babies - Teddy Bears', PartNumber: '4300', PackageDimensions: 0.90inchesx7.40inchesx4.50inchesx0.40pounds, Edition: '1997', ItemDimensions: 4.00inchesx10.00inchesx6.00inchesx0.31pounds, OperatingSystem: [], Actor: [], ProductTypeName: 'TOYS_AND_GAMES', Manufacturer: 'Beanie Babies - Teddy Bears', Director: [], GemType: [])]), Offers: None, SalesRankings: ^SalesRankings^{}(SalesRank: [SalesRank{}(ProductCategoryId: 'toy_display_on_website', Rank: '38666')])), Product{}(Identifiers: ^Identifiers^{}(MarketplaceASIN: ^MarketplaceASIN^{}(ASIN: 'B00ROSX26K', MarketplaceId: 'ATVPDKIKX0DER'), SKUIdentifier: None), LowestOfferListings: None, Relationships: ^Relationships^{}(VariationParent: []), CompetitivePricing: [], AttributeSets: ^AttributeSets^{}(ItemAttributes: [ItemAttributes{'xml:lang': 'en-US'}(Publisher: 'Ty', SmallImage: Image{}(URL: 'http://ecx.images-amazon.com/images/I/414%2BgrfnUsL._SL75_.jpg', Width: 73{'Units': 'pixels'}, Height: 75{'Units': 'pixels'}), Binding: 'Toy', MediaType: [], ProductTypeName: 'TOYS_AND_GAMES', Color: 'white/black', ManufacturerMinimumAge: 36{'Units': 'months'}, ProductGroup: 'Toy', Title: 'Ty Beanie Babies 6" Checkers The Bunny', Platform: [], Artist: [], PackageQuantity: '1', Brand: 'TY', ListPrice: None, Model: '41142', Format: [], Author: [], Creator: [], MaterialType: [], Feature: ["Official product from Ty's wildly popular Beanie Babies Collection", 'Handmade with the finest quality standards in the industry', "Look for the familiar heart-shaped tag that means you've purchased an authentic Ty product", 'Collect Them All!!!'], Languages: ^Languages^{}(Language: [^Language^{}(Name: 'dutch', Type: 'Published'), ^Language^{}(Name: 'english', Type: 'Published'), ^Language^{}(Name: 'french', Type: 'Published'), ^Language^{}(Name: 'german', Type: 'Published'), ^Language^{}(Name: 'italian', Type: 'Published'), ^Language^{}(Name: 'german', Type: 'Unknown')]), Studio: 'Ty', Label: 'Ty', PartNumber: 'TY41142', PackageDimensions: 1.90inchesx4.80inchesx2.90inchesx0.17pounds, ItemDimensions: 5.00inchesx3.98inchesx2.60inchesx0.16pounds, OperatingSystem: [], Actor: [], Manufacturer: 'Ty', Department: 'kids', Director: [], GemType: [])]), Offers: None, SalesRankings: ^SalesRankings^{}(SalesRank: [SalesRank{}(ProductCategoryId: 'toy_display_on_website', Rank: '11154')])), Product{}(Identifiers: ^Identifiers^{}(MarketplaceASIN: ^MarketplaceASIN^{}(ASIN: 'B00342O6WE', MarketplaceId: 'ATVPDKIKX0DER'), SKUIdentifier: None), LowestOfferListings: None, Relationships: ^Relationships^{}(VariationParent: []), CompetitivePricing: [], AttributeSets: ^AttributeSets^{}(ItemAttributes: [ItemAttributes{'xml:lang': 'en-US'}(Publisher: 'Fun Express', SmallImage: Image{}(URL: 'http://ecx.images-amazon.com/images/I/51WlYwdFS0L._SL75_.jpg', Width: 75{'Units': 'pixels'}, Height: 75{'Units': 'pixels'}), Binding: 'Toy', MediaType: [], ProductTypeName: 'TOYS_AND_GAMES', ManufacturerMinimumAge: 60{'Units': 'months'}, ProductGroup: 'Toy', Title: 'Plush Mini Bean Bag Animal Assortment(50 pcs)', Platform: [], Artist: [], PackageQuantity: '1', Brand: 'Cool Fun', ListPrice: None, Model: '5/387', Format: [], Author: [], Creator: [], MaterialType: ['plush'], Feature: ['Includes 50 small assorted animal bean bags', 'Each has a "to/from" tag so it is ready for gift giving', 'Fun stocking stuffer or birthday party favor for kids', 'Bean bags measure approx. 3 1/2"', 'Assorted colors and designs - pattern may repeat'], Languages: None, Studio: 'Fun Express', Label: 'Fun Express', PartNumber: '5/387', PackageDimensions: 6.20inchesx10.70inchesx8.40inchesx2.15pounds, ItemDimensions: None, OperatingSystem: [], Actor: [], Manufacturer: 'Fun Express', Director: [], GemType: [])]), Offers: None, SalesRankings: ^SalesRankings^{}(SalesRank: [SalesRank{}(ProductCategoryId: 'toy_display_on_website', Rank: '4506')])), Product{}(Identifiers: ^Identifiers^{}(MarketplaceASIN: ^MarketplaceASIN^{}(ASIN: 'B00JVKTK4C', MarketplaceId: 'ATVPDKIKX0DER'), SKUIdentifier: None), LowestOfferListings: None, Relationships: ^Relationships^{}(VariationParent: []), CompetitivePricing: [], AttributeSets: ^AttributeSets^{}(ItemAttributes: [ItemAttributes{'xml:lang': 'en-US'}(Publisher: 'TY', SmallImage: Image{}(URL: 'http://ecx.images-amazon.com/images/I/51KMXo3UL7L._SL75_.jpg', Width: 50{'Units': 'pixels'}, Height: 75{'Units': 'pixels'}), Title: 'Ty Beanie Baby "Peace"', Binding: 'Toy', MediaType: [], ProductTypeName: 'TOYS_AND_GAMES', Color: 'Multi', Manufacturer: 'TY', ProductGroup: 'Toy', ManufacturerMinimumAge: 60{'Units': 'months'}, Platform: [], Artist: [], PackageQuantity: '1', Brand: 'TY', ListPrice: None, Model: 'Peace Bear', Format: [], Author: [], Creator: [], MaterialType: [], Feature: ['TY Beanie Baby "Peace"', 'Made of PVC Pellets', '1996', 'Errors on swing tag', 'No number in tush tag'], Languages: None, Studio: 'TY', Label: 'TY', PackageDimensions: 0.60inchesx8.00inchesx3.00inchesx0.30pounds, ItemDimensions: None, OperatingSystem: [], Actor: [], HazardousMaterialType: 'Unknown', Department: 'Womens', Director: [], GemType: [])]), Offers: None, SalesRankings: ^SalesRankings^{}(SalesRank: [SalesRank{}(ProductCategoryId: 'toy_display_on_website', Rank: '1168851')])), Product{}(Identifiers: ^Identifiers^{}(MarketplaceASIN: ^MarketplaceASIN^{}(ASIN: 'B006YTEM5U', MarketplaceId: 'ATVPDKIKX0DER'), SKUIdentifier: None), LowestOfferListings: None, Relationships: ^Relationships^{}(VariationParent: []), CompetitivePricing: [], AttributeSets: ^AttributeSets^{}(ItemAttributes: [ItemAttributes{'xml:lang': 'en-US'}(Publisher: 'Ty', ManufacturerMaximumAge: 180.0{'Units': 'months'}, SmallImage: Image{}(URL: 'http://ecx.images-amazon.com/images/I/41S%2BIQck7sL._SL75_.jpg', Width: 75{'Units': 'pixels'}, Height: 75{'Units': 'pixels'}), Binding: 'Toy', MediaType: [], ProductTypeName: 'TOYS_AND_GAMES', Color: 'white, brown, black', ManufacturerMinimumAge: 36.0{'Units': 'months'}, ProductGroup: 'Toy', Title: 'Ty Beanie Baby Banjo Plush - Beagle', Platform: [], Artist: [], PackageQuantity: '1', ReleaseDate: '2012-09-20', Brand: 'Ty Beanie Babies', ListPrice: USD 8.99, Studio: 'Ty', Model: '42069', Format: [], Author: [], Creator: [], MaterialType: ['plush'], Feature: ['Collect Them All', "Look for the familiar heart-shaped tag that means you've purchased an authentic Ty product", 'Handmade with the finest quality standards in the industry', 'High quality for a low price', 'Ty from our heart to yours'], Languages: ^Languages^{}(Language: [^Language^{}(Name: 'italian', Type: 'Manual'), ^Language^{}(Name: 'german', Type: 'Manual'), ^Language^{}(Name: 'french', Type: 'Manual'), ^Language^{}(Name: 'english', Type: 'Manual'), ^Language^{}(Name: 'spanish', Type: 'Manual'), ^Language^{}(Name: 'german', Type: 'Unknown')]), ItemPartNumber: 'TY42069', IsAdultProduct: 'false', Label: 'Ty', PartNumber: 'TY42069', PackageDimensions: 2.60inchesx6.20inchesx4.00inchesx0.05pounds, ItemDimensions: 8.00inchesx3.00inchesx4.00inches, Warranty: 'No Warranty', OperatingSystem: [], Actor: [], Manufacturer: 'Ty', Director: [], GemType: [])]), Offers: None, SalesRankings: ^SalesRankings^{}(SalesRank: [SalesRank{}(ProductCategoryId: 'toy_display_on_website', Rank: '11712')])), Product{}(Identifiers: ^Identifiers^{}(MarketplaceASIN: ^MarketplaceASIN^{}(ASIN: 'B00001QED0', MarketplaceId: 'ATVPDKIKX0DER'), SKUIdentifier: None), LowestOfferListings: None, Relationships: ^Relationships^{}(VariationParent: []), CompetitivePricing: [], AttributeSets: ^AttributeSets^{}(ItemAttributes: [ItemAttributes{'xml:lang': 'en-US'}(Publisher: 'Beanie Babies', SmallImage: Image{}(URL: 'http://ecx.images-amazon.com/images/I/71BZJ2S2BPL._SL75_.gif', Width: 60{'Units': 'pixels'}, Height: 75{'Units': 'pixels'}), Binding: 'Toy', MediaType: [], ProductTypeName: 'TOYS_AND_GAMES', ManufacturerMinimumAge: 3{'Units': 'months'}, ProductGroup: 'Toy', Title: 'Ty Beanie Babies - Seaweed the Otter', Platform: [], Artist: [], PackageQuantity: '1', Brand: 'Beanie Babies', ListPrice: None, Model: 'TY4080', Format: [], Author: [], Creator: [], MaterialType: [], Feature: [], Languages: None, Studio: 'Beanie Babies', Label: 'Beanie Babies', PartNumber: '4080', PackageDimensions: 1.30inchesx8.00inchesx3.50inchesx0.35pounds, ItemDimensions: 0.02pounds, OperatingSystem: [], Actor: [], Manufacturer: 'Beanie Babies', Director: [], GemType: [])]), Offers: None, SalesRankings: ^SalesRankings^{}(SalesRank: [SalesRank{}(ProductCategoryId: 'toy_display_on_website', Rank: '20132')])), Product{}(Identifiers: ^Identifiers^{}(MarketplaceASIN: ^MarketplaceASIN^{}(ASIN: 'B00S4RLOEW', MarketplaceId: 'ATVPDKIKX0DER'), SKUIdentifier: None), LowestOfferListings: None, Relationships: ^Relationships^{}(VariationParent: []), CompetitivePricing: [], AttributeSets: ^AttributeSets^{}(ItemAttributes: [ItemAttributes{'xml:lang': 'en-US'}(Publisher: 'Ty', SmallImage: Image{}(URL: 'http://ecx.images-amazon.com/images/I/41RtN7iuqoL._SL75_.jpg', Width: 75{'Units': 'pixels'}, Height: 69{'Units': 'pixels'}), Binding: 'Toy', MediaType: [], ProductTypeName: 'TOYS_AND_GAMES', Color: 'White', ManufacturerMinimumAge: 36.00{'Units': 'months'}, ProductGroup: 'Toy', Title: 'Ty Beanie Babies Tundra - White Tiger', Platform: [], Artist: [], PackageQuantity: '1', Brand: 'Ty', ListPrice: None, Model: '42106', Format: [], Author: [], Creator: [], MaterialType: [], Feature: ['Birthday: November 29'], Languages: ^Languages^{}(Language: [^Language^{}(Name: 'german', Type: 'Unknown')]), Studio: 'Ty', Label: 'Ty', Size: '6 inch', PartNumber: '42106', PackageDimensions: 2.91inchesx5.98inchesx4.72inchesx0.22pounds, ItemDimensions: 5.91inchesx1.97inchesx1.97inchesx0.21pounds, OperatingSystem: [], Actor: [], Manufacturer: 'Ty', Department: 'toys', Director: [], GemType: [])]), Offers: None, SalesRankings: ^SalesRankings^{}(SalesRank: [SalesRank{}(ProductCategoryId: 'toy_display_on_website', Rank: '4159')])), Product{}(Identifiers: ^Identifiers^{}(MarketplaceASIN: ^MarketplaceASIN^{}(ASIN: 'B00CM6Y1Z0', MarketplaceId: 'ATVPDKIKX0DER'), SKUIdentifier: None), LowestOfferListings: None, Relationships: ^Relationships^{}(VariationParent: []), CompetitivePricing: [], AttributeSets: ^AttributeSets^{}(ItemAttributes: [ItemAttributes{'xml:lang': 'en-US'}(Publisher: 'Ty', ManufacturerMaximumAge: 180.0{'Units': 'months'}, SmallImage: Image{}(URL: 'http://ecx.images-amazon.com/images/I/51gdURVCAsL._SL75_.jpg', Width: 64{'Units': 'pixels'}, Height: 75{'Units': 'pixels'}), Binding: 'Toy', IsAutographed: 'false', MediaType: [], IsMemorabilia: 'false', Color: 'Pinky', ManufacturerMinimumAge: 36.0{'Units': 'months'}, ProductGroup: 'Toy', Title: 'Ty Beanie Boos Pinky Pink Barn Owl Plush', Platform: [], Artist: [], PackageQuantity: '1', Brand: 'Ty Beanie Boos', ListPrice: USD 9.99, Studio: 'Ty', Model: '36094', Format: [], Author: [], Creator: [], MaterialType: ['Polyester'], Feature: ["Official product from Ty's wildly popular Beanie Babies Collection", "Look for the familiar heart-shaped tag that means you've purchased an authentic Ty product", 'Handmade with the finest quality standards in the industry', 'Collect Them All !!!'], Languages: ^Languages^{}(Language: [^Language^{}(Name: 'dutch', Type: 'Published'), ^Language^{}(Name: 'english', Type: 'Published'), ^Language^{}(Name: 'french', Type: 'Published'), ^Language^{}(Name: 'german', Type: 'Published'), ^Language^{}(Name: 'italian', Type: 'Published'), ^Language^{}(Name: 'italian', Type: 'Manual'), ^Language^{}(Name: 'german', Type: 'Manual'), ^Language^{}(Name: 'french', Type: 'Manual'), ^Language^{}(Name: 'english', Type: 'Manual'), ^Language^{}(Name: 'spanish', Type: 'Manual')]), ItemPartNumber: '36094', IsAdultProduct: 'false', Label: 'Ty', Size: '6"', PartNumber: '36094', PackageDimensions: 2.83inchesx5.12inchesx3.86inchesx0.22pounds, ItemDimensions: 7.00inchesx5.00inchesx6.50inchesx0.21pounds, Warranty: 'No Warranty', OperatingSystem: [], Actor: [], ProductTypeName: 'TOYS_AND_GAMES', Manufacturer: 'Ty', Director: [], GemType: [])]), Offers: None, SalesRankings: ^SalesRankings^{}(SalesRank: [SalesRank{}(ProductCategoryId: 'toy_display_on_website', Rank: '1536'), SalesRank{}(ProductCategoryId: '166461011', Rank: '38')]))])))

I'm sure I can figure out how to parse the XML using an XML parser, but it seems like Response and ResponseFactory would make life much easier for me. I can't find any real world examples on line to copy and play with, and as I have no programming background I don't fully understand all the documentation properly. Any help would be greatly appreciated.

0

There are 0 answers