Metadata-Version: 2.4
Name: yunmao
Version: 0.1.4
Summary: Official Python SDK for Yunmao APIs
Author: Yunmao
License: MIT
Keywords: api,sdk,yunmao
Requires-Python: >=3.9
Requires-Dist: httpx<1,>=0.26
Requires-Dist: websockets<16,>=12
Provides-Extra: test
Requires-Dist: pytest>=8; extra == 'test'
Description-Content-Type: text/markdown

# Yunmao Python SDK

Official Python SDK for Yunmao APIs.

## Install

```bash
pip install yunmao
```

## Quick Start

```python
from yunmao import YunmaoClient

client = YunmaoClient(
    api_key="<YOUR_API_KEY>",
    base_url="<YOUR_BASE_URL>",
)
```

Pass the appropriate `base_url` for your environment.

For API methods, supported parameters, and full examples, see the official Yunmao developer documentation.

## Realtime ASR

```python
async with client.asr.stream(
    language_hint="<LANGUAGE_HINT>",
    audio_format="pcm",
    sample_rate=16000,
) as stream:
    await stream.send(pcm16_chunk)
    await stream.end()

    async for event in stream:
        print(event["type"])
```

`client.asr.stream()` uses `Authorization: Bearer <YOUR_API_KEY>` by default. If a WebSocket environment cannot set custom headers, pass `auth="query"`.

## Errors

```python
from yunmao import YunmaoAPIError

try:
    # Call a Yunmao API method here.
    pass
except YunmaoAPIError as error:
    print(error.status_code)
    print(error.code)
    print(error.message)
    print(error.request_id)
```

The SDK preserves:

- `status_code`: HTTP status
- `code`: Yunmao business error code
- `message`: server message
- `request_id`: request id when the server provides it
- `response_body`: parsed raw response body

## Test

```bash
python -m venv .venv
.venv/bin/python -m pip install -e ".[test]"
.venv/bin/python -m pytest
```

Automated tests use mocks and do not call paid APIs.
