def start_upload_session(server, auth_token, site_id):
"""
Creates a POST request that initiates a file upload session.
'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
Returns a session ID that is used by subsequent functions to identify the upload session.
"""
url = server + "/api/{0}/sites/{1}/fileUploads".format(VERSION, site_id)
server_response = requests.post(url, headers={'x-tableau-auth': auth_token})
_check_status(server_response, 201)
xml_response = ET.fromstring(_encode_for_display(server_response.text))
return xml_response.find('t:fileUpload', namespaces=xmlns).get('uploadSessionId')
评论列表
文章目录