From b2cc26a1f3bf23e7819060a90104856cca3de3a3 Mon Sep 17 00:00:00 2001 From: SafriDane Date: Mon, 12 Jul 2021 10:26:25 +0930 Subject: [PATCH] Update rest_api_base.py TableauRestApiBase36 does not initialise TableauRestAPIBase (commented out) I'm not 100% sure why, assume it has something to do with the implementation of personal access tokens. add_user_by_username() in user.py validates the specified site_role against the tuple of allowed site_roles as defined in TableauRestAPIBase which doesn't get initialised for versions after 3.6. Adding this tuple to TableauRestApiBase36 Would be good to understand better why the chain of inheritance is broken in 3.6? --- tableau_rest_api/methods/rest_api_base.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tableau_rest_api/methods/rest_api_base.py b/tableau_rest_api/methods/rest_api_base.py index b14dc33..4f18509 100755 --- a/tableau_rest_api/methods/rest_api_base.py +++ b/tableau_rest_api/methods/rest_api_base.py @@ -1362,6 +1362,22 @@ def __init__(self, server: str, username: Optional[str] = None, password: Option self._request_obj: Optional[RestXmlRequest] = None self._request_json_obj: Optional[RestJsonRequest] = None + self.site_roles = ( + u'Interactor', + u'Publisher', + u'SiteAdministrator', + u'Unlicensed', + u'UnlicensedWithPublish', # This was sunset at some point + u'Viewer', + u'ViewerWithPublish', + u'ServerAdministrator', + u'ReadOnly', + u'Explorer', + u'ExplorerCanPublish', + u'SiteAdministratorExplorer', + u'Creator', + u'SiteAdministratorCreator' + ) # Lookup caches to minimize calls self.username_luid_cache = {} self.group_name_luid_cache = {} @@ -1498,4 +1514,4 @@ def update_server_active_directory_domain(self, domain_id: str, new_name: Option url = self.build_api_url("domains/{}".format(domain_id), server_level=True) response = self.send_update_request(url=url, request=tsr) self.end_log_block() - return response \ No newline at end of file + return response