from functools import cache import httpx from owsclient import M2MTokenManager, OwsClient from secrets_manager.python_ext import PythonSecretsManager from src.config import APPLICATION_NAME, get_settings @cache def ows() -> OwsClient: settings = get_settings() return OwsClient( settings.ENVIRONMENT, APPLICATION_NAME, timeout=httpx.Timeout(30.0), m2m_token_manager=M2MTokenManager( secrets_manager=PythonSecretsManager( application_context=False, environment=settings.ENVIRONMENT, service_name=APPLICATION_NAME, ), environment=settings.token_manager_environment, service_name=APPLICATION_NAME, ), )