diff --git a/src/python/PythonSDK/foundationallm/operations/operations_manager.py b/src/python/PythonSDK/foundationallm/operations/operations_manager.py index e7c00166ad..31ee3f1c61 100644 --- a/src/python/PythonSDK/foundationallm/operations/operations_manager.py +++ b/src/python/PythonSDK/foundationallm/operations/operations_manager.py @@ -19,7 +19,8 @@ def __init__(self, config: Configuration): # Retrieve the State API configuration settings. self.state_api_url = config.get_value('FoundationaLLM:APIEndpoints:StateAPI:APIUrl').rstrip('/') self.state_api_key = config.get_value('FoundationaLLM:APIEndpoints:StateAPI:APIKey') - self.env = os.environ.get('FOUNDATIONALLM_ENV', 'prod') + env = os.environ.get('FOUNDATIONALLM_ENV', 'prod') + self.verify_certs = False if env == 'dev' else True async def create_operation( self, @@ -53,7 +54,7 @@ async def create_operation( r = requests.post( f'{self.state_api_url}/instances/{instance_id}/operations/{operation_id}', headers=headers, - verify=False if self.env == 'dev' else True + verify=self.verify_certs ) if r.status_code != 200: @@ -107,7 +108,7 @@ async def update_operation(self, f'{self.state_api_url}/instances/{instance_id}/operations/{operation_id}', json=operation.model_dump(exclude_unset=True), headers=headers, - verify=False if self.env == 'dev' else True + verify=self.verify_certs ) if r.status_code == 404: @@ -154,7 +155,7 @@ async def get_operation( r = requests.get( f'{self.state_api_url}/instances/{instance_id}/operations/{operation_id}', headers=headers, - verify=False if self.env == 'dev' else True + verify=self.verify_certs ) if r.status_code == 404: @@ -198,7 +199,7 @@ async def set_operation_result( f'{self.state_api_url}/instances/{instance_id}/operations/{operation_id}/result', json=completion_response.model_dump(), headers=headers, - verify=False if self.env == 'dev' else True + verify=self.verify_certs ) if r.status_code == 404: @@ -242,7 +243,7 @@ async def get_operation_result( r = requests.get( f'{self.state_api_url}/instances/{instance_id}/operations/{operation_id}/result', headers=headers, - verify=False if self.env == 'dev' else True + verify=self.verify_certs ) if r.status_code == 404: @@ -287,7 +288,7 @@ async def get_operation_log( r = requests.get( f'{self.state_api_url}/instances/{instance_id}/operations/{operation_id}/logs', headers=headers, - verify=False if self.env == 'dev' else True + verify=self.verify_certs ) if r.status_code == 404: