How can I download file with accepted changes with Python?

Dear all,

I have used code here to upload a file and accept tracked changes in it.

The result is at https://api.groupdocs.cloud/v2.0/comparison/storage/file/output/result.docx, and that’s the file that I would like to download now.

I have found this page documenting the download API, but I’m confused as from Common_Utilities.Utils import Common_Utilities gives me a ModuleNotFoundError.

I’d be grateful for any tips.
How can I download that file using Python?

Cheers, Manuel

@msoutopico

Please find the sample code to download a file from cloud storage.

# Import module
import groupdocs_comparison_cloud
from shutil import copyfile

# Get your app_sid and app_key at https://dashboard.groupdocs.cloud (free registration is required).
app_sid = "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx"
app_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

file_api = groupdocs_comparison_cloud.FileApi.from_keys(app_sid, app_key)

#Download Document from Storage        
request_download = groupdocs_comparison_cloud.DownloadFileRequest("output/result.docx")
response_download = file_api.download_file(request_download)
       
copyfile(response_download, "result.docx")
print("Result {}".format(response_download))

Thanks you so much, Tilal. It works!

I just noticed this is documented further down below in the same page :stuck_out_tongue: I was too tired yesterday ^^

Thanks.

Cheers, Manuel

1 Like