###前提・実現したいこと
python でアマゾンのAPIを使い、下記のようなJSONを得ています(下記はリクエスト結果(response)をそのままprintしたものです)。
ここから、商品サイズ(「ItemDimensions」が「3.54inchesx9.06inchesx7.48inchesx1.01pounds」と記述されている部分)を取り出したいのですが、名前空間を使うことが前提になっているようで、取り出し型がわかりません。
名前空間の'xmlns': 'http://mws.amazonservices.com/schema/Products/2011-10-01', 'xmlns:ns2': 'http://mws.amazonservices.com/schema/Products/2011-10-01/default.xsd'をどう使えばよいか、「名前空間」や「namespace」などで検索してみたのですが、理解が追い付かず、どのように取り出せばよいか、参考記事でも構いませんので、アドバイスをいただけたら幸いです。
GetMatchingProductForIdResponse{'xmlns': 'http://mws.amazonservices.com/schema/Products/2011-10-01'}(ResponseMetadata: ^ResponseMetadata^{}(RequestId: 'c2955a8f-6ab0-437a-8182-1c8944ad39cf'), GetMatchingProductForIdResult: [GetMatchingProductForIdResult{'IdType': 'ASIN', 'Id': 'B01JOBU8DY', 'status': 'Success'}(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^{}(SKUIdentifier: None, MarketplaceASIN: ^MarketplaceASIN^{}(MarketplaceId: 'A1VC38T7YXB528', ASIN: 'B01JOBU8DY')), AttributeSets: ^AttributeSets^{}(ItemAttributes: [ItemAttributes{'xml:lang': 'ja-JP'}(PackageQuantity: '1', Label: 'コナミ', Format: [], GemType: [], Author: [], SmallImage: Image{}(Height: 64{'Units': 'pixels'}, Width: 75{'Units': 'pixels'}, URL: 'http://ecx.images-amazon.com/images/I/311vAqBS4HL.SL75.jpg'), Director: [], ItemDimensions: 3.54inchesx9.06inchesx7.48inchesx1.01pounds, ManufacturerMinimumAge: 108.0{'Units': 'months'}, Actor: [], Creator: [], Languages: None, IsAdultProduct: 'false', Feature: [], ReleaseDate: '2016-11-26', PartNumber: 'CG1524', Title: '遊戯王アーク・ファイブ OCG\xa0DIMENSION\xa0BOX\xa0-LIMITED\xa0EDITION-', Manufacturer: 'コナミ', MaterialType: [], ListPrice: JPY 3240.00, Binding: 'おもちゃ&ホビー', Model: 'CG1524', PackageDimensions: 3.54inchesx9.06inchesx7.48inchesx1.01pounds, MediaType: [], Studio: 'コナミ', Artist: [], OperatingSystem: [], Publisher: 'コナミ', Platform: [], ProductTypeName: 'HOBBIES', ProductGroup: 'Hobby', Brand: 'コナミデジタルエンタテインメント')]), SalesRankings: ^SalesRankings^{}(SalesRank: [SalesRank{}(ProductCategoryId: 'hobby_display_on_website', Rank: '1417'), SalesRank{}(ProductCategoryId: '2189359051', Rank: '86')]), LowestOfferListings: None, CompetitivePricing: [], Relationships: ^Relationships^{}(VariationParent: []), Offers: None)]))])
###該当のソースコード
(上記結果はamazonのbotoというライブラリで下記のようにリクエストしたものです。)
response =conn.get_matching_product_for_id(MarketplaceId=marketplaceId,IdType="ASIN",IdList=["B01JOBU8DY"])
###補足情報(言語/FW/ツール等のバージョンなど)
より詳細な情報
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/12/06 08:49