From 1375f0f8b229fd72b306fe7bc63cea50eebd392b Mon Sep 17 00:00:00 2001 From: Vladimir Vlasov Date: Mon, 28 Jun 2021 20:14:20 +0600 Subject: [PATCH 1/2] Add possibility to customize soap_cache_file location --- FuelSDK/client.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/FuelSDK/client.py b/FuelSDK/client.py index 1ebbfb8..45d20ea 100644 --- a/FuelSDK/client.py +++ b/FuelSDK/client.py @@ -33,7 +33,7 @@ class ET_Client(object): soap_client = None auth_url = None soap_endpoint = None - soap_cache_file = "soap_cache_file.json" + soap_cache_file = None use_oAuth2_authentication = None account_id = None scope = None @@ -118,6 +118,15 @@ def configure_client(self, get_server_wsdl, params, tokenResponse): elif 'FUELSDK_SOAP_ENDPOINT' in os.environ: self.soap_endpoint = os.environ['FUELSDK_SOAP_ENDPOINT'] + if params is not None and "soap_cache_file_loc" in params: + self.soap_cache_file = params["soap_cache_file_loc"] + elif config.has_option("Web Services", "soap_cache_file_loc"): + self.soap_cache_file = config.get("Web Services", "soap_cache_file_loc") + elif "FUELSDK_SOAP_CACHE_FILE_LOC" in os.environ: + self.soap_cache_file = os.environ["FUELSDK_SOAP_CACHE_FILE_LOC"] + else: + self.soap_cache_file = "soap_cache_file.json" + if params is not None and "wsdl_file_local_loc" in params: wsdl_file_local_location = params["wsdl_file_local_loc"] elif config.has_option("Web Services", "wsdl_file_local_loc"): From 9a204cbf543ad9244bd963d466b960dcadefbb08 Mon Sep 17 00:00:00 2001 From: Vladimir Vlasov Date: Mon, 28 Jun 2021 20:16:17 +0600 Subject: [PATCH 2/2] Add exception raising when unable to create 'soap_cache_file.json' on a read-only file systems --- FuelSDK/client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FuelSDK/client.py b/FuelSDK/client.py index 45d20ea..9998ba3 100644 --- a/FuelSDK/client.py +++ b/FuelSDK/client.py @@ -411,7 +411,8 @@ def get_soap_endpoint(self): return soap_url else: return default_endpoint - + except PermissionError as e: + raise e except Exception as e: return default_endpoint