"""ows-salegoals model.""" from oto import response from owsrequest import request as requests from ows_product_physical.constant import error from ows_product_physical.constant import service_name def get_goals(product_id): """Get goals by product_id.""" goals_response = requests.get( service_name.OWS_SALES_GOALS, '/goals/{}'.format(product_id)) if goals_response.status_code != 200: return response.create_error_response( status=goals_response.status_code, message=goals_response.reason, code=error.SALES_GOALS_ERROR ) return response.Response(message=goals_response.json())