Skip to content

Commit 5f85f74

Browse files
Update README.md
1 parent df56dc1 commit 5f85f74

1 file changed

Lines changed: 56 additions & 18 deletions

File tree

README.md

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# GroupDocs.Conversion Cloud Python SDK
2-
Python package for communicating with the GroupDocs.Conversion Cloud API
2+
3+
This repository contains GroupDocs.Conversion Cloud SDK for Python source code. This SDK has been developed to help you get started with using our document conversion REST API, allowing to seamlessly convert your documents to any format you need. With this single API, you can convert back and forth between over 50 types of documents and images, including all Microsoft Office and OpenDocument file formats, PDF documents, HTML, CAD, raster images and many more.
34

45
## Requirements
56

@@ -18,32 +19,69 @@ Or clone repository and install it via [Setuptools](http://pypi.python.org/pypi/
1819
python setup.py install
1920
```
2021

21-
## Getting Started
22+
### Create an account
23+
Creating an account is very simple. Go to Dashboard to create a free account.
24+
We’re using Single Sign On across our websites, therefore, if you already have an account with our services, you can use it to also access the [Dashboard](https://dashboard.groupdocs.cloud).
25+
26+
### Create an API client app
27+
Before you can make any requests to GroupDocs Cloud API you need to get a Client Id and a Client Secret. This will be used to invoke GroupDocs Cloud API. You can get it by creating a new [Application](https://dashboard.groupdocs.cloud/applications).
28+
29+
## Convert document
2230

2331
Please follow the [installation procedure](#installation) and then run following:
2432

2533
```python
2634
# Import module
2735
import groupdocs_conversion_cloud
2836

29-
# Get your app_sid and app_key at https://dashboard.groupdocs.cloud (free registration is required).
30-
app_sid = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
31-
app_key = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
37+
# Get your clientId and clientSecret at https://dashboard.groupdocs.cloud (free registration is required).
38+
client_id = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
39+
client_secret = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
3240

3341
# Create instance of the API
34-
api = groupdocs_conversion_cloud.InfoApi.from_keys(app_sid, app_key)
35-
36-
try:
37-
# Retrieve supported conversion types
38-
request = groupdocs_conversion_cloud.GetSupportedConversionTypesRequest()
39-
response = api.get_supported_conversion_types(request)
40-
41-
# Print out supported conversion types
42-
print("Supported conversion types:")
43-
for format in response:
44-
print('{0} to [{1}]'.format(format.source_format, ', '.join(format.target_formats)))
45-
except groupdocs_conversion_cloud.ApiException as e:
46-
print("Exception when calling get_supported_conversion_types: {0}".format(e.message))
42+
apiInstance = groupdocs_conversion_cloud.ConvertApi.from_keys(client_id, client_secret)
43+
44+
# Prepare request
45+
request = groupdocs_conversion_cloud.ConvertDocumentDirectRequest("pdf", "myFile.docx")
46+
47+
# Convert
48+
result = apiInstance.convert_document_direct(request)
49+
50+
print("Document converted: " + result)
51+
52+
```
53+
54+
## Convert document using cloud storage
55+
56+
```python
57+
# Import module
58+
import groupdocs_conversion_cloud
59+
60+
# Get your clientId and clientSecret at https://dashboard.groupdocs.cloud (free registration is required).
61+
client_id = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
62+
client_secret = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
63+
64+
# Create instances of the APIs
65+
fileApi = groupdocs_conversion_cloud.FileApi.from_keys(client_id, client_secret)
66+
convertApi = groupdocs_conversion_cloud.ConvertApi.from_keys(client_id, client_secret)
67+
68+
# Upload file
69+
fileApi.upload_file(groupdocs_conversion_cloud.UploadFileRequest("myFile.docx", "myFile.docx"))
70+
71+
# Prepare convert settings
72+
settings = groupdocs_conversion_cloud.ConvertSettings()
73+
settings.file_path = "myFile.docx"
74+
settings.format = "pdf"
75+
settings.output_path = "converted"
76+
77+
# Convert
78+
result = convertApi.convert_document(groupdocs_conversion_cloud.ConvertDocumentRequest(settings))
79+
80+
print("Document converted: " + result)
81+
82+
# Download result
83+
response = fileApi.download_file(groupdocs_conversion_cloud.DownloadFileRequest("converted/myFile.pdf", None))
84+
4785
```
4886

4987
## Licensing

0 commit comments

Comments
 (0)