Date Posted:
Product: TIBCO Spotfire®
Product: TIBCO Spotfire®
Problem:
How to write a file from Jupyter Python Notebook into the workspace in TIBCO Data Science Team Studio?
Solution:
How to write a file from Jupyter Python Notebook into the workspace in TIBCO Data Science Team Studio You can write a file from Jupyter Python Notebook into the workspace as a workfile in TIBCO Data Science Team Studio by making the following API call:
import alpine as AlpineAPI SDS_info = { "host": "ts******.com", "port": "80", "username": "j****", "password": "********", "workspaceid" : "968" } session = AlpineAPI.APIClient(SDS_info['host'], SDS_info['port'], SDS_info['username'], SDS_info['password']) url = 'http://{}/api/workspaces/{}/workfiles?session_id={}'.format(SDS_info['host'],SDS_info['workspaceid'], session.token) payload = [("workfile[entity_subtype]", "text")] files = {"workfile[versions_attributes][0][contents]": open("LoanRiskInstallment.pmml", 'rb')} if session.session.headers.get("Content-Type") is not None: session.session.headers.pop("Content-Type") response = session.session.post(url, files=files, data=payload, verify=False)
Comments
0 comments
Article is closed for comments.