from typing import Any from owsclient import M2MTokenManager, OwsClient from secrets_manager.lambda_ext import LambdaSecretsManager # type: ignore import config ows_client = OwsClient( environment=config.ENVIRONMENT, service_name=config.APPLICATION_NAME, m2m_token_manager=M2MTokenManager( secrets_manager=LambdaSecretsManager( environment=config.ENVIRONMENT, service_name=config.APPLICATION_NAME, ), environment=config.ENVIRONMENT, service_name=config.APPLICATION_NAME, ), ) def get_ows_client() -> OwsClient: return ows_client def delete_product(upc: str) -> None: """Calls ows-product to delete the product by UPC.""" response = get_ows_client().delete("ows-product-digital", f"/product/upc/{upc}") response.raise_for_status() def get_product_by_upc(upc: str) -> Any: """Calls ows-product to get the product by upc.""" response = get_ows_client().get("ows-product", f"/product/upc/{upc}") response.raise_for_status() return response.json()