Skip to main content

Official Python SDK for Yunmao APIs

Project description

Yunmao Python SDK

Official Python SDK for Yunmao APIs.

Install

pip install yunmao

Quick Start

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

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

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

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yunmao-0.1.10.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yunmao-0.1.10-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file yunmao-0.1.10.tar.gz.

File metadata

  • Download URL: yunmao-0.1.10.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for yunmao-0.1.10.tar.gz
Algorithm Hash digest
SHA256 d9bfcaceb04058e3aa68a99fb5a973b31f8f126c39f44790cdc5b6282894368f
MD5 dff39ffcd1ba5cf4ef4dba8ae0e5e300
BLAKE2b-256 89d04a49223d8cadbe99ed45066bee155d28c2bdcf400c0e88145c73b6cae85f

See more details on using hashes here.

File details

Details for the file yunmao-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: yunmao-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for yunmao-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 ac22a0f0b2d4b13f85f4de442bae9b0d562d8ee7ef5d8bcb95ef2ca8486e7adb
MD5 0db3edef48ddf9196a137fccf28f126d
BLAKE2b-256 08efc18c26be88c62634e5a9f58b886c480967837f15aaf00a00ff20878466e5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page