Smartling API SDK for Python

3.1.9 · active · verified Sun Apr 12

The Smartling API SDK for Python simplifies interaction with Smartling's cloud-based translation services APIs from Python applications. It provides a convenient, idiomatic Python interface to automate translation workflows, including file uploads, downloads, job management, and string operations. The current version is 3.1.9, and the library receives regular updates to support new API features and improvements.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the `ProjectsApi` client using Smartling API credentials (user identifier, user secret, and account ID) retrieved from environment variables. It then attempts to list the first three projects associated with the account, verifying successful connectivity and basic API interaction. Ensure you set the `SMARTLING_USER_IDENTIFIER`, `SMARTLING_USER_SECRET`, and `SMARTLING_ACCOUNT_ID` environment variables before running.

import os
from smartlingApiSdk.api import ProjectsApi

USER_IDENTIFIER = os.environ.get('SMARTLING_USER_IDENTIFIER', '')
USER_SECRET = os.environ.get('SMARTLING_USER_SECRET', '')
ACCOUNT_ID = os.environ.get('SMARTLING_ACCOUNT_ID', '')

if not all([USER_IDENTIFIER, USER_SECRET, ACCOUNT_ID]):
    print("Please set SMARTLING_USER_IDENTIFIER, SMARTLING_USER_SECRET, and SMARTLING_ACCOUNT_ID environment variables.")
else:
    try:
        projects_api = ProjectsApi(USER_IDENTIFIER, USER_SECRET, ACCOUNT_ID)
        # List projects in the account
        projects_response = projects_api.listProjects()
        print("Successfully connected to Smartling and listed projects.")
        print(f"First 3 projects: {projects_response.data.items[:3]}")
    except Exception as e:
        print(f"An error occurred: {e}")

view raw JSON →