"""Logic for Image Location.""" from images.models import image_assets as image_assets_model from images.models import ows_product as ows_product_model def get_image_location(upc): """Get image location. Gets the location for an image along with account information from ows-product microservice. Args: upc (int): the upc for the associated image. Returns: Response: the path for the image. """ image_path = image_assets_model.get_image_path_by_upc(upc) if not image_path: return image_path account_info = ows_product_model.get_vendor_and_subaccount_by_upc(upc) if not account_info: return account_info image_path.message.update({'account_info': account_info.message}) return image_path