def update_product_item_by_retailer_id(self, catalog_id, retailer_id,
                                        params):
     """
         Update product item specified by retailer_id and catalog_id
     """
     catalog = ProductCatalog(catalog_id)
     result = catalog.update_product(retailer_id, **params)
     return result
예제 #2
0
)

if __name__ == '__main__':
    catalog_id = '<INSERT_YOUR_CATALOG_ID_HERE>'
    catalog = ProductCatalog(catalog_id)

    items = []
    for line in sys.stdin.readlines():
        if line.endswith('\n'):
            items.append(line[:-1].split(','))
        else:
            items.append(line.split(','))

    for item in items:
        product_id, new_price = item
        if new_price == '-':
            response = catalog.update_product(
                product_id,
                availability=Product.Availability.out_of_stock
            )
            print('Product {} is now out of stock'.format(product_id))
        else:
            # prices should be in cents and be an integer
            new_price_in_cents = int(float(new_price) * 100)
            response = catalog.update_product(
                product_id,
                price=new_price_in_cents,
                availability=Product.Availability.in_stock,
            )
            print('Product {} is now costs R$ {}'.format(product_id, new_price))
예제 #3
0
    config['access_token'],
)

if __name__ == '__main__':
    catalog_id = '<INSERT_YOUR_CATALOG_ID_HERE>'
    catalog = ProductCatalog(catalog_id)

    items = []
    for line in sys.stdin.readlines():
        if line.endswith('\n'):
            items.append(line[:-1].split(','))
        else:
            items.append(line.split(','))

    for item in items:
        product_id, new_price = item
        if new_price == '-':
            response = catalog.update_product(
                product_id, availability=Product.Availability.out_of_stock)
            print('Product {} is now out of stock'.format(product_id))
        else:
            # prices should be in cents and be an integer
            new_price_in_cents = int(float(new_price) * 100)
            response = catalog.update_product(
                product_id,
                price=new_price_in_cents,
                availability=Product.Availability.in_stock,
            )
            print('Product {} is now costs R$ {}'.format(
                product_id, new_price))