Skip to main content

Put object

put_object(key, content, content_type="application/octet-stream")

Uploads the content object to TruStorage under the name key

f = open("directory/file.txt", "r")
storage.put_object(key="directory/file.txt", content=f, content_type="text/plain")

Parameters

ParamTypeDescriptionRequired
keystrObject name in the storageTrue
contentobjectAn object having callable read() returning bytes objectTrue
content_typestrContent type of the objectFalse