in config_helper.py [0:0]
def update_config(self, force: bool = False) -> bool:
"""Request the latest configration.
Returns True if a new version of configuration was received. False
indicates that no attempt was made, or that no new version was found.
"""
if (
time.time() - self._last_update_time < self.expire
) and not force:
return False
response = self._client.get_configuration(
Application=self._appconfig_application,
Environment=self._appconfig_environment,
Configuration=self._appconfig_profile,
ClientId=self._client_id,
ClientConfigurationVersion=self._configuration_version,
)
if response["ConfigurationVersion"] == self._configuration_version:
self._last_update_time = time.time()
return False
content = response["Content"].read()
try:
self._config = json.loads(content.decode("utf-8"))
except json.JSONDecodeError as error:
raise ValueError(error.msg) from error
self._last_update_time = time.time()
self._configuration_version = response["ConfigurationVersion"]
return True