groupdocs-translation-cloud / groupdocs-translation-cloud-python

Python library for communicating with the GroupDocs.Translation Cloud API
5 stars 5 forks source link

F**k! The example is incomplete, what is your brain thinking? #2

Open Deng-Xian-Sheng opened 5 months ago

Deng-Xian-Sheng commented 5 months ago

You should write the text of the example, such as HelloWord!

import time
import os
import groupdocs_translation_cloud
from groupdocs_translation_cloud.models.markdown_file_request import MarkdownFileRequest
from groupdocs_translation_cloud.models.status_response import StatusResponse
from groupdocs_translation_cloud.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.groupdocs.cloud/v2.0/translation
# See configuration.py for a list of all supported configuration parameters.
configuration = groupdocs_translation_cloud.Configuration(
    host = "https://api.groupdocs.cloud/v2.0/translation"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure OAuth2 access token for authorization: JWT
configuration = groupdocs_translation_cloud.Configuration(
    host = "https://api.groupdocs.cloud/v2.0/translation",
    client_id = "YOUR_CLIENT_ID",
    client_secret = "YOUR_CLIENT_SECRET"
)

# Enter a context with an instance of the API client
with groupdocs_translation_cloud.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = groupdocs_translation_cloud.TranslationApi(api_client)
    markdown_file_request = groupdocs_translation_cloud.MarkdownFileRequest() # MarkdownFileRequest | String in body of request, containing JSON with parameters for translation. (optional)

    try:
        # Translate Markdown files
        api_response = api_instance.markdown_post(markdown_file_request=markdown_file_request)
        print("The response of TranslationApi->markdown_post:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling TranslationApi->markdown_post: %s\n" % e)