@@ -1830,10 +1830,18 @@ def connection_detail(self, connection_guid: str, sort: str = 'MODIFIED', sort_a
18301830 response .raise_for_status ()
18311831 return response .json ()
18321832
1833- def connection_fetch_connection (self , connection_guid , config_json_string , include_columns = False , authentication_type = 'SERVICE_ACCOUNT' ):
1833+ def connection_fetch_connection (self , connection_guid : str , include_columns = False ,
1834+ authentication_type = 'SERVICE_ACCOUNT' , config_json_string : Optional [str ] = None ,
1835+ use_internal_endpoint = False ):
18341836 endpoint = 'connection/fetchConnection'
18351837
1836- url = self .non_public_base_url + endpoint
1838+ if use_internal_endpoint is True :
1839+ url = self .non_public_base_url + endpoint
1840+ if config_json_string is None :
1841+ raise Exception ('The config_json_string (a JSON object converted to string using json.dumps() ) is required' )
1842+ else :
1843+ url = self .base_url + endpoint
1844+
18371845 # Example of a config_json, which may vary per connection
18381846 #
18391847 # config_json_string_example = '''
@@ -1846,11 +1854,13 @@ def connection_fetch_connection(self, connection_guid, config_json_string, inclu
18461854 # '''
18471855 #
18481856 post_data = {'id' : connection_guid ,
1849- 'config' : config_json_string ,
18501857 'includeColumns' : str (include_columns ).lower (),
18511858 'authentication_type' : authentication_type
18521859 }
18531860
1861+ if config_json_string is not None :
1862+ post_data ['config' ] = config_json_string
1863+
18541864 response = self .requests_session .post (url = url , data = post_data )
18551865 response .raise_for_status ()
18561866 return response .json ()
0 commit comments