> ## Documentation Index
> Fetch the complete documentation index at: https://api-docs.ollang.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Python Library

> Official Python client library for the Ollang API.

# Python Library

The official Python library wraps the Ollang integration API — projects, uploads, orders, revisions, and custom instructions — in a simple, Pythonic client.

Source code lives in the [`python/` directory of the SDK repository](https://github.com/ollang/sdk/tree/main/python).

## Installation

```bash theme={null}
pip install ollang-sdk
```

Requires Python 3.8+. The only dependency is `requests`.

## Authentication

1. Sign up or log in at [Olabs](https://lab.ollang.com)
2. Create or select a project
3. Generate an API key from project settings

```python theme={null}
from ollang import Ollang

client = Ollang(api_key="your-api-key")
```

## Quick Start

```python theme={null}
from ollang import Ollang

client = Ollang(api_key="your-api-key")

# Upload a file (creates a project)
upload = client.uploads.direct(
    "./video.mp4",
    name="My Video",
    source_language="en",
)

# Create an order
orders = client.orders.create(
    order_type="cc",
    level=1,
    project_id=upload["projectId"],
    target_language_configs=[
        {"language": "fr", "isRush": False},
        {"language": "de", "isRush": False},
    ],
)

# Check order status
status = client.orders.get(orders[0]["orderId"])
print(status)
```

## Resources

| Resource                     | Description                            |
| ---------------------------- | -------------------------------------- |
| `client.projects`            | Read and list projects                 |
| `client.uploads`             | Upload files (video, audio, documents) |
| `client.orders`              | Create and track translation orders    |
| `client.revisions`           | Request revisions on completed orders  |
| `client.custom_instructions` | Set custom translation instructions    |

All methods return the parsed JSON response as plain dicts and lists. Non-2xx responses raise `ollang.OllangAPIError`, which carries `status_code` and the parsed error `body`.

## More Examples

```python theme={null}
# List orders with pagination and filters
page = client.orders.list(page=1, take=20, status="completed")
for order in page["data"]:
    print(order["id"], order.get("status"))

# Request a revision on an order
client.revisions.create(
    order_id="ORDER_ID",
    type="wrongSubtitle",
    time="00:01:23",
    description="Fix the terminology in this segment",
)

# Custom instructions
client.custom_instructions.create(
    key="tone",
    value="Formal, brand-safe tone for all marketing content",
)
```

<Note>
  For endpoints the library doesn't wrap yet, the underlying HTTP client is
  available: `client.client.get("/integration/supported-languages")`. See the
  full [API reference](/apis/ollang-api-reference/direct-file-upload) for all
  endpoints.
</Note>
