"""Interface to the ows-product-review microservice.""" from oto import response from owsrequest import request from project_manager.constant.services import OWS_PRODUCT_REVIEW from project_manager.util.response_handler_util import safe_decode_json def get_status(product_id): """Get the Gated DIY AWAL product status. We fetch it from ows-content-review using simplified logic. No corrections as of now. Args: product_id (int): the product id Returns: response.Response: status of rejections call and a dict with data """ ows_product_review_response = request.get( OWS_PRODUCT_REVIEW, f'/status/{product_id}', ) info_body = safe_decode_json( ows_product_review_response, OWS_PRODUCT_REVIEW) if ows_product_review_response.status_code != 200: return response.create_error_response( status=ows_product_review_response.status_code, code=info_body.get('code'), message=info_body.get('message')) return response.Response(message=info_body)