{"library":"python-lokalise-api","title":"Lokalise API Client for Python","description":"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.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install python-lokalise-api"],"cli":null},"imports":["from lokalise.client import LokaliseClient"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nfrom lokalise.client import LokaliseClient\n\n# Get your Lokalise API token from environment variables for security\nAPI_TOKEN = os.environ.get('LOKALISE_API_TOKEN', '')\n\nif not API_TOKEN:\n    print(\"Error: LOKALISE_API_TOKEN environment variable not set.\")\n    print(\"Please set it (e.g., export LOKALISE_API_TOKEN='YOUR_TOKEN') and retry.\")\nelse:\n    try:\n        client = LokaliseClient(API_TOKEN)\n        # List projects (auto_pagination is False by default, returns first page)\n        projects = client.projects().list()\n        if projects:\n            print(f\"Found {len(projects)} projects on the first page:\")\n            for project in projects:\n                print(f\"  ID: {project.project_id}, Name: {project.name}\")\n        else:\n            print(\"No projects found or API token is invalid.\")\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n","lang":"python","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}