Hello, I was trying to write a simple program using the aspose-words-cloud library. I installed it on my windows machine conda python (2.7) with the pip install aspose-words-cloud command.
I import the library like this:
import os
import asposestoragecloud
import asposewordscloud
import asposewordscloud.models.requests
Then, in my method,when I try to build a request like this: request = asposewordscloud.models.requests.PostDocumentSaveAsRequest(filename, save_options)
I am told PostDocumentSaveAsRequest is not an attribute of asposewordscloud.models.requests.
Please let me know if this is an installation issue, or how to correctly troubleshoot it.
Thanks
@tchemod
Thanks for your inquiry. Your installation is correct. But please note we have recently released an improved API version 4. We have also released updated Python SDK for V4 version. There are a lot of breaking changes. PostDocumentSaveAsReqest changed to SaveAsRequest. Please find sample code for reference. However, if you face any issue please feel free to contact us for any assistance. Please note V1.1 will remain working with previous SDKs.
import asposewordscloud
import asposewordscloud.models.requests
api_client = asposewordscloud.ApiClient()
# Get App key and App SID from https://cloud.aspose.com
api_client.configuration.host = 'https://api.aspose.cloud'
api_client.configuration.api_key['api_key'] = 'xxxxxxxxxxxxxxxxxxxxxx' # Put your appKey here
api_client.configuration.api_key['app_sid'] = 'xxxxxx-xxxxxx-xxxxxx-xxxxx-xxxxx' # Put your appSid here
words_api = asposewordscloud.WordsApi(api_client)
filename = 'TestFile.docx'
remote_name = 'TestPostDocumentSaveAs.docx'
dest_name = 'TestPostDocumentSaveAs.epub'
#upload PDF file to storage
request_upload = asposewordscloud.models.requests.UploadFileRequest(filename,remote_name)
response_upload = words_api.upload_file(request_upload)
#Convert PDF to Text and save to storage
save_options = asposewordscloud.SaveOptionsData(save_format='epub', file_name=dest_name)
request_conversion = asposewordscloud.models.requests.SaveAsRequest(remote_name, save_options)
response_conversion = words_api.save_as(request_conversion)
print(response_conversion)