"""Interface for the ows-product-workflow microservice.""" from owsrequest import request as requests from owsresponse import response from sentry_sdk import capture_exception from blacklist_manager.constants import error from blacklist_manager.constants import service_name def get_error_corrections(product_id): """Check ownership of a product. Args: product_id: containing a unique identifier of a product id. account_type (str): account type (either “subaccount” or “vendor”). account_id (str): account id. Cannot be empty. Returns: response.Response: result of checking the ownership. """ try: path = f'/product/{product_id}/correction' result = requests.get(service_name.OWS_PRODUCT_WORKFLOW, path) if result.status_code == 404: return response.Response(message={}) return response.Response( message=result.json(), status=result.status_code) except Exception: capture_exception() return response.create_error_response( code=error.INTERNAL_ERROR, message='connection error', status=500)