def get_product(self): """ Return product inventory data from Cloud Commerce. Returns: ccapi.inventory_items.Product. """ if self.order_product.product_id in self.update.products: return self.update.products[self.order_product.product_id] for attempt in range(100): try: return CCAPI.get_product(self.order_product.product_id) except Exception: time.sleep(10) continue else: break else: raise Exception("Unable to load product {}.".format( self.order_product.sku))
def setUp(self): """Get product.""" super().setUp() self.register_request(requests.FindProductSelectedOptionsOnly, json=self.RESPONSE_DATA) self.product = CCAPI.get_product(self.PRODUCT_ID)
def description(self): """Return the description of the product.""" if self._description is None: self._description = CCAPI.get_product(self.id).description return self._description
def _reload(self): self.load_from_cc_data(CCAPI.get_product(self.id).json)
def get_product(product_id): """Retrive a Product from Cloud Commerce.""" product = CCAPI.get_product(product_id).json return Variation(product)