"""Interface for the ows-assets microservice.""" from oto import response from owsrequest import request as requests import sentry_sdk from product.constants import header from product.constants import service_name def copy_product_artwork(product_id, new_product_id, orchard_user_id): """Copy product artwork. Args: product_id (int): The product_id of the product to copy from. new_product_id (int): The product_id of the product to copy to. orchard_user_id (str): orchard user id from grass. Returns: response.Response """ try: path = "/image/{}/copy/{}".format(product_id, new_product_id) body = {header.ORCHARD_USER_ID: orchard_user_id} assets_response = requests.post(service_name.OWS_ASSETS, path, json=body) except Exception as exception: sentry_sdk.capture_exception(exception) return response.create_fatal_response( message="Could not connect to ows-assets." ) return response.Response(status=assets_response.status_code)