Metadata-Version: 2.4
Name: luaward
Version: 0.1.1
Summary: Official Luaward Python SDK (Sync & Async) with Luarmor drop-in compatibility wrapper
Author-email: Luaward <support@luaward.com>
License: MIT
Project-URL: Homepage, https://luaward.com
Project-URL: Documentation, https://luaward.com/docs
Project-URL: Repository, https://github.com/luaward
Keywords: luaward,luau,roblox,sdk,licensing
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# luaward - Python SDK

Sync and async Python client for the Luaward Developer REST API (`/v3`), including `LuarmorCompat`. Requires Python **3.10+**.

## Installation

```bash
pip install luaward
```

Official Python SDK for [Luaward](https://luaward.com). Supports both synchronous and asynchronous calls with zero external dependencies (the async client delegates to the sync HTTP client via `asyncio.to_thread()` using Python's standard `urllib`; see [luaward.com/docs](https://luaward.com/docs) and [github.com/luaward](https://github.com/luaward)).

## Credentials and URL

Pass a **Developer API key** (`lwa_live_...`) from your workspace's Developer API settings via `api_key` (not `token`, and not a CLI/IDE/MCP personal token `lwm_...`). The default `base_url` is `https://api.luaward.com` (the client appends `/v3` automatically). Project and script IDs are 32-character hexadecimal IDs from the dashboard or API. Keep credentials strictly in a server-side environment.

## Sync client

```python
import os
from luaward import LuawardClient, LuarmorCompat

lw = LuawardClient(
    api_key=os.environ["LUAWARD_API_KEY"],
    project_id=os.environ["LUAWARD_PROJECT_ID"],
)

created = lw.keys.create(
    discord_id="123456789012345678",
    key_days=30,
    note="Monthly access",
)
print("Generated key:", created["user_key"])
lw.keys.reset_hwid(created["user_key"])

queued = lw.scripts.upload(
    os.environ["LUAWARD_SCRIPT_ID"],
    'print("Hello from SDK")',
    preset="balanced",
)
print("Queued build:", queued["build_id"])

compat = LuarmorCompat(
    api_key=os.environ["LUAWARD_API_KEY"],
    project_id=os.environ["LUAWARD_PROJECT_ID"],
)
compat.reset_hwid(user_key=created["user_key"], force=True)
```

`key_days` starts counting on first key use, while `auth_expire` sets an explicit Unix timestamp expiration in seconds and takes precedence over `key_days` when both are provided. Valid `preset` values are `fast`, `balanced`, or `max`. Once a new build reaches **Ready**, the loader switches to it automatically unless a newer build has been selected.

## Async client

```python
import os
from luaward import AsyncLuawardClient

lw = AsyncLuawardClient(
    api_key=os.environ["LUAWARD_API_KEY"],
    project_id=os.environ["LUAWARD_PROJECT_ID"],
)

async def on_redeem(discord_id: str):
    created = await lw.keys.create(discord_id=discord_id, key_days=30, note="Discord redeem")
    return created["user_key"]
```

The sync client provides `keys`, `scripts`, and `stats`, while the async client exposes `keys` and `request()`. Use `await lw.request(method, path, body)` for other endpoints, verifying fields and scopes against the [REST reference](https://luaward.com/docs/api/overview). Full parity with every third-party Luarmor wrapper is not guaranteed; test existing automation separately before migrating.

By default, requests retry HTTP `429` and `503` responses up to 3 times (configurable via `max_retries` and `retry_base_delay`). Typed exceptions are defined in `luaward.exceptions`, with raw API responses available on `error.payload`.
