-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert_odt_docx.py
31 lines (21 loc) · 1023 Bytes
/
convert_odt_docx.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from __future__ import print_function
import time
import cloudmersive_convert_api_client
from cloudmersive_convert_api_client.rest import ApiException
from pprint import pprint
def convent_odt_to_docx(input_file, outputfile, KEY):
# Configure API key authorization: Apikey
configuration = cloudmersive_convert_api_client.Configuration()
configuration.api_key['Apikey'] = KEY
# create an instance of the API class
api_instance = cloudmersive_convert_api_client.ConvertDocumentApi(cloudmersive_convert_api_client.ApiClient(configuration))
try:
# Convert Office Open Document ODT to Word DOCX
api_response = api_instance.convert_document_odt_to_docx(input_file)
time.sleep(0.1)
with open(outputfile, 'wb') as fp:
fp.write(api_response)
except ApiException as e:
print("Exception when calling ConvertDocumentApi->convert_document_odt_to_docx: %s\n" % e)
if __name__ == '__main__':
convent_odt_to_docx(input_file, outputfile, KEY)