Key Maker๏
- class sp_api.util.KeyMaker(key_mapping=None, *, deep=True)๏
Map the different keys amazon uses for the same property to a single one
Examples
literal blocks:
key_mapping = { 'sku': ['seller_sku', 'sellerSku'], 'title': ['product_name'] } res = KeyMaker(key_mapping, deep=True).convert_keys({ 'seller_sku': 1, 'product_name': { 'sellerSku': [ 'seller_sku', 3, { 'sellerSku': 22, 'product_name': { 'title': 'Foo', 'x': 'bar' } } ] } }) res {'sku': 1, 'title': {'sku': ['seller_sku', 3, {'sku': 22, 'title': {'title': 'Foo', 'x': 'bar'}}]}}
- convert_keys(self, data: dict or list)๏
Map the different keys amazon uses for the same property to a single one
- Parameters:
data โ [dict] or dict
- Returns:
Transformed data