【发布时间】:2021-11-25 13:25:50
【问题描述】:
我正在尝试使用 Python 将画面视图导出为图像/csv(没关系)。我用谷歌搜索,发现 REST API 在这里会有所帮助,所以我创建了一个个人访问令牌并编写了以下命令来连接:-
import tableauserverclient as TSC
from tableau_api_lib import TableauServerConnection
from tableau_api_lib.utils.querying import get_views_dataframe, get_view_data_dataframe
server_url = 'https://tableau.mariadb.com'
site = ''
mytoken_name = 'Marine'
mytoken_secret = '$32mcyTOkmjSFqKBeVKEZYpMUexseV197l2MuvRlwHghMacCOa'
server = TSC.Server(server_url, use_server_version=True)
tableau_auth = TSC.PersonalAccessTokenAuth(token_name=mytoken_name, personal_access_token=mytoken_secret, site_id=site)
with server.auth.sign_in_with_personal_access_token(tableau_auth):
print('[Logged in successfully to {}]'.format(server_url))
成功进入并给出消息:-
[Logged in successfully to https://tableau.mariadb.com]
但是,我现在不知道如何使用 Python 访问画面工作簿。我在这里搜索:-
https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_workbooks_and_views.htm
但无法在 python 中编写这些命令,例如 GET 或其他命令。
谁能帮忙?
【问题讨论】:
-
您不应发布您的令牌信息。如果您要使用 tableau_api_lib,请查看他们的文档。 pypi.org/project/tableau-api-lib
标签: python automation tableau-api export-to-csv tableau-desktop