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
- key_mapping = {
‘sku’: [‘seller_sku’, ‘sellerSku’], ‘title’: [‘product_name’]
}
- KeyMaker(key_mapping, deep=True).convert_keys({
‘goo’: {‘x’: {}}, ‘seller_sku’: 1, ‘product_name’: {
- ‘sellerSku’: [
‘seller_sku’, 3, {
‘sellerSku’: 22, ‘product_name’: {
‘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