基于 GroupDocs.Translation API 在 Python 中创建跨平台数据科学、AI 和自动化解决方案。关注业务逻辑而不是技术细节。
开始免费试用GroupDocs.Translation offers real-time machine translation for texts, documents, images and resources. Powerful machine learning algorithms and sophisticated neural networks provide a quality close to that of a professional human translator, but much faster and more cost-effective. Running on a high-performance cloud server hosted by GroupDocs, it can translate PDF, Microsoft Office and OpenOffice documents, Markdown files, and .NET resources into 46 European, Middle East and Asian languages (across 128 language pairs). The API not only translates text, but also accurately preserves metadata, structure, styles, and layout of documents.
This SDK greatly simplifies the interaction with GroupDocs.Translation Cloud services from Python code, allowing you to focus on business logic rather than the technical details. It handles all the routine operations such as establishing connections, sending API requests, and parsing responses, wrapping all these tasks into a few simple methods that can be used in any Python application or workbook. The Python SDK, demo applications, documentation, and examples are open source distributed under the MIT license. You can use them for any purpose and change any part of the code.
GroupDocs.Translation Cloud SDK for Python 附带详细的开发人员指南和实时代码示例,可让您立即开始使用 API 功能。只需在 GroupDocs Cloud 创建一个免费帐户,获取 APP SID 和密钥信息以与 GroupDocs Cloud API 进行通信,您就可以制作 API 并可以使用 SDK。
GroupDocs.Translation Cloud 是一个 REST API,可以轻松地与任何语言或平台集成,能够管理 HTTP 请求和响应。它支持所有流行的云存储服务,如 Google Cloud、Drive、DropBox 和 Amazon S3,无需任何依赖即可进行交互。
//Get your App SID, App Key and Storage Name at https://dashboard.groupdocs.cloud (free registration is required).
import time
import groupdocs_translation_cloud
from groupdocs_translation_cloud import TextRequest, PdfFileRequest, Format
api = groupdocs_translation_cloud.api.TranslationApi()
file_api = groupdocs_translation_cloud.api.FileApi()
api.api_client.configuration.client_id = "YOU_CLIENT_ID"
api.api_client.configuration.client_secret = "YOU_CLIENT_SECRET"
text_request = TextRequest(source_language="en",
target_languages=["es", "fr", "ru"],
texts=["Hello World!", "This is a test text"],
origin="your_application_name",
contains_markdown=False)
response = api.text_post(text_request)
if response.status == 202:
while True:
status_response = api.text_request_id_get(response.id)
if status_response.status == 200:
for lang in status_response.translations:
print(lang + ": " + status_response.translations[lang][0])
break
time.sleep(2)
GroupDocs.Translation Cloud API 受 SSL 保护,身份验证请求需要签名和 AppSID 查询参数或 OAuth 2.0 授权标头。