Hardware Reference
In-Depth Information
uploadFileInputs.set_AppKey("yourAppKey")
uploadFileInputs.set_FileContents(encoded_string)
uploadFileInputs.set_Root("sandbox")
# Execute choreo
uploadFileResults = uploadFileChoreo.execute_with_results(uploadFileInputs)
Let's now see the details of this script. It starts by including the required libraries from the
Temboo Python SDK:
from temboo.core.session import TembooSession
from temboo.Library.Dropbox.FilesAndMetadata import UploadFile
The Python script will also take the name of the picture we want to upload as an argument:
with open ( str (sys . argv[ 1 ]), "rb" ) as image_file:
encoded_string = base64 . b64encode(image_file . read())
Remember these Temboo credentials that you created earlier ? This is where you need to
enter them:
session = TembooSession( 'yourTembooName' , 'yourTembooApp' , 'yourTembooKey' )
We can then create the correct Dropbox library to upload files, called a “Choreo” on Tem-
boo:
uploadFileChoreo = UploadFile(session)
uploadFileInputs = uploadFileChoreo . new_input_set()
It is now the time to enter all the informations about your Dropbox account, like your app
Key, app Secret, Access Token an Access Token Secret:
uploadFileInputs . set_AppSecret( "appSecret" )
uploadFileInputs . set_AccessToken( "accessToken" )
uploadFileInputs . set_FileName( str (sys . argv[ 1 ]))
Search WWH ::




Custom Search