def move_workbook(server, auth_token, site_id, workbook_id, project_id):
"""
Moves the specified workbook to another project.
'server' specified server address
'auth_token' authentication token that grants user access to API calls
'site_id' ID of the site that the user is signed into
'workbook_id' ID of the workbook to move
'project_id' ID of the project to move workbook into
"""
url = server + "/api/{0}/sites/{1}/workbooks/{2}".format(VERSION, site_id, workbook_id)
# Build the request to move workbook
xml_request = ET.Element('tsRequest')
workbook_element = ET.SubElement(xml_request, 'workbook')
ET.SubElement(workbook_element, 'project', id=project_id)
xml_request = ET.tostring(xml_request)
server_response = requests.put(url, data=xml_request, headers={'x-tableau-auth': auth_token})
_check_status(server_response, 200)
move_workbook_projects.py 文件源码
python
阅读 14
收藏 0
点赞 0
评论 0
评论列表
文章目录