Error when calling publish_workbook on a file greater than 20MB
I have recently started to use tableau_tools to upload dynamically created Tableau workbooks to Tableau server. I can get a code snippet to work when uploading workbooks smaller than 20MB, but I receive an error when I try to upload larger notebooks. I think the problem may be coming from the way in which this package handles the sending of chunks of data to the Tableau API, but I'm not sure.
Below is the error that I receive in my code snippet:
TypeError Traceback (most recent call last)
<ipython-input-315-8c1a4ee06859> in <module>()
1 t.publish_workbook(
2 LOCAL_FILE_NAME, SERVER_WORKBOOK_NAME, project, check_published_ds=False,
----> 3 connection_username='xxxxxxxx', connection_password='xxxxxxxx')
~/personal_python_libraries/tableau_tools/tableau_rest_api/tableau_rest_api_connection.py in publish_workbook(self, workbook_filename, workbook_name, project_obj, overwrite, connection_username, connection_password, save_credentials, show_tabs, check_published_ds, oauth_flag)
2124 {"overwrite": overwrite}, connection_username, connection_password,
2125 save_credentials, show_tabs=show_tabs, check_published_ds=check_published_ds,
-> 2126 oauth_flag=oauth_flag)
2127 workbook = xml.findall('.//t:workbook', self.ns_map)
2128 return workbook[0].get('id')
~/personal_python_libraries/tableau_tools/tableau_rest_api/tableau_rest_api_connection.py in publish_content(self, content_type, content_filename, content_name, project_luid, url_params, connection_username, connection_password, save_credentials, show_tabs, check_published_ds, oauth_flag)
2272 for piece in self.read_file_in_chunks(content_file):
2273 self.log("Appending chunk to upload session {}".format(upload_session_id))
-> 2274 self.append_to_file_upload(upload_session_id, piece, final_filename)
2275
2276 # Finalize the publish
~/personal_python_libraries/tableau_tools/tableau_rest_api/tableau_rest_api_connection.py in append_to_file_upload(self, upload_session_id, content, filename)
2325 publish_request += 'Content-Type: application/octet-stream\r\n\r\n'
2326
-> 2327 publish_request += content
2328
2329 publish_request += "\r\n--{}--".format(boundary_string)
TypeError: Can't convert 'bytes' object to str implicitly
I am using Python 3.5.2 and the most recent version of tableau_tools. Please let me know if I can provide more information.
Had a similar issue - have a look at my comment here: https://github.com/bryantbhowell/tableau_tools/issues/51#issuecomment-476694493