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-apiVerified import paths — ran on the pinned version, not inferred.
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.
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.
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.
Store your API token in environment variables (e.g., `LOKALISE_API_TOKEN`) and access it using `os.environ.get('LOKALISE_API_TOKEN')`.