Registry / communication / python-lokalise-api

python-lokalise-api

JSON →
library4.0.6pypypi✓ verified 85d ago

The official Python interface for the Lokalise API v2, designed to interact with your Lokalise translation projects programmatically. It provides a comprehensive set of functionalities to manage projects, keys, translations, and more. Currently at version 4.0.4, the library maintains an active release cadence, frequently adding new features and ensuring compatibility with the latest Lokalise API changes.

pip install python-lokalise-api
INSTALL
IMPORT
SIG · PYTHON-LOKALISE-AP
P
python-lokalise-api
communicationpythonv4.0.6
Install
2.2s avg
Import
Disk
21MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.0.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 22.9MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.2s · import 0.000s · 23MB
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Client
from lokalise import Client
from lokalise.client import LokaliseClient

Initializes the LokaliseClient using an API token from environment variables and fetches a list of projects. This demonstrates basic client setup and interaction, ensuring the API token is handled securely.

import os from lokalise.client import LokaliseClient # Get your Lokalise API token from environment variables for security API_TOKEN = os.environ.get('LOKALISE_API_TOKEN', '') if not API_TOKEN: print("Error: LOKALISE_API_TOKEN environment variable not set.") print("Please set it (e.g., export LOKALISE_API_TOKEN='YOUR_TOKEN') and retry.") else: try: client = LokaliseClient(API_TOKEN) # List projects (auto_pagination is False by default, returns first page) projects = client.projects().list() if projects: print(f"Found {len(projects)} projects on the first page:") for project in projects: print(f" ID: {project.project_id}, Name: {project.name}") else: print("No projects found or API token is invalid.") except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
breakingVersion 4.x introduced significant breaking changes from v3.x. The most notable change is the adoption of `pydantic` v2 for API responses, meaning methods now return strongly-typed Pydantic models instead of raw dictionaries. Additionally, the underlying HTTP client switched from `requests` to `httpx`.
fix
Update your code to expect Pydantic model objects (e.g., `project.name` instead of `project['name']`). Ensure `pydantic>=2.0` and `httpx` are installed. Refer to the official v4.0.0 migration guide.
affects: >=4.0.0
gotchaBy default, API calls that return a list of items (e.g., `client.projects().list()`) will only return the first page of results. Automatic pagination is disabled by default for performance and control.
fix
To get all results, you can either enable auto-pagination when initializing the client (`LokaliseClient(token, enable_auto_pagination=True)`) or manually iterate through pages using the `next_page()` method on the response object.
affects: >=4.0.0
gotchaAPI tokens should be handled securely. Hardcoding tokens directly into your script is a security risk, especially in production environments.
fix
Store your API token in environment variables (e.g., `LOKALISE_API_TOKEN`) and access it using `os.environ.get('LOKALISE_API_TOKEN')`.
affects: all
Upgrade
Version history
4.0.6latest on PyPI · released May 15, 2026
Audit
Dependencies
httpxrequiredUsed for making HTTP requests to the Lokalise API, replacing the 'requests' library in v4.x.
pydanticrequiredUsed for data validation and parsing API responses into strongly-typed models (v2.x required for v4.x).
Agent activity
28 hits · last 30 days
node
24
OpenAI (training)
1
Resources
python-lokalise-api — pip install python-lokalise-api · libregistry