Created
April 9, 2015 20:20
-
-
Save felipebizz/39bf2ba1c0ba18e25e89 to your computer and use it in GitHub Desktop.
Download Image Cmis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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