diff --git a/tableau_rest_api/methods/datasource.py b/tableau_rest_api/methods/datasource.py index 2b25f35..db97857 100644 --- a/tableau_rest_api/methods/datasource.py +++ b/tableau_rest_api/methods/datasource.py @@ -125,7 +125,7 @@ def update_datasource_connection_by_luid(self, datasource_luid: str, new_server_ new_connection_username: Optional[str] = None, new_connection_password: Optional[str] = None) -> ET.Element: self.start_log_block() - tsr = self.__build_connection_update_xml(new_server_address, new_server_port, + tsr = self.rest_api_base.__build_connection_update_xml(new_server_address, new_server_port, new_connection_username, new_connection_password) url = self.build_api_url("datasources/{}/connection".format(datasource_luid)) diff --git a/tableau_rest_api/methods/rest_api_base.py b/tableau_rest_api/methods/rest_api_base.py index 72e3355..5c78934 100644 --- a/tableau_rest_api/methods/rest_api_base.py +++ b/tableau_rest_api/methods/rest_api_base.py @@ -187,13 +187,12 @@ def build_api_url(self, call: str, server_level: bool = False, def build_url_parameter_string(map_dict: Optional[Dict] = None, name_value_tuple_list: Optional[List[Tuple]] = None, hand_built_portion: Optional[str] = None): encoded_list = None - if len(name_value_tuple_list) == 0: - encoded_list = None - else: - for v in name_value_tuple_list: - if len(v) != 2: - raise InvalidOptionException('Each element should have a two-element Tuples (Name, Value)') - encoded_list = urlencode(name_value_tuple_list) + if name_value_tuple_list is not None: + if len(name_value_tuple_list) > 0: + for v in name_value_tuple_list: + if len(v) != 2: + raise InvalidOptionException('Each element should have a two-element Tuples (Name, Value)') + encoded_list = urlencode(name_value_tuple_list) if hand_built_portion is not None and encoded_list is None: final_string = hand_built_portion diff --git a/tableau_rest_api/methods/workbook.py b/tableau_rest_api/methods/workbook.py index 2bd87bd..db80e3e 100644 --- a/tableau_rest_api/methods/workbook.py +++ b/tableau_rest_api/methods/workbook.py @@ -166,7 +166,7 @@ def update_workbook_connection_by_luid(self, wb_luid: str, connection_luid: str, new_connection_username: Optional[str] = None, new_connection_password: Optional[str] = None) -> ET.Element: self.start_log_block() - tsr = self.__build_connection_update_xml(new_server_address, new_server_port, new_connection_username, + tsr = self.rest_api_base.__build_connection_update_xml(new_server_address, new_server_port, new_connection_username, new_connection_password) url = self.build_api_url("workbooks/{}/connections/{}".format(wb_luid, connection_luid)) response = self.send_update_request(url, tsr)