Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Download Image Cmis
# pip install cmislib
import os
import urllib
from cmislib import CmisClient
def download_thumb_file(cmis_object_id, cmis_repo, cmis_url, cmis_user, cmis_passwd, download_base_folder):
client = CmisClient(cmis_url, cmis_user, cmis_passwd)
repo = client.getRepository(cmis_repo)
cmis_object = repo.getObject(cmis_object_id)
object_file_name = cmis_object.getProperties()['filename']
download_url = str(cmis_url) + '/' + str(cmis_repo) + '/content/' + str(object_file_name) + '?id=' + str(cmis_object_id)
download_url = download_url.replace('://', '://' +str(cmis_user)+ ':' +str(cmis_passwd)+ '@')
final_path = os.path.join(download_base_folder, object_file_name)
urllib.urlretrieve(url=download_url, filename=final_path)
print download_url
if __name__ == '__main__':
cmis_url = 'http://{ur}:8080/nuxeo/atom/cmis'
cmis_user = 'Administrator'
cmis_passwd = 'Administrator'
cmis_repo = '{tenant}'
cmis_object_id = 'e1bd5d77-2c3f-4838-a410-0aed16bbb3b1'
download_base_folder = "/home/felipe/tmp"
download_thumb_file(cmis_object_id, cmis_repo, cmis_url, cmis_user, cmis_passwd, download_base_folder)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment