Skip to main content

Minimal Python client for the tomfun speech-to-text web API (token auth, language hint).

Project description

tomfun-speech-to-text-client

Minimal async Python client for the tomfun speech-to-text web API.

  • Token authentication (Authorization: Bearer <token>)
  • Language hint passed to Whisper
  • Upload local files (chunked) or submit a remote URL
  • Streams status via Server-Sent Events

Single runtime dependency: aiohttp.

Install

pip install tomfun-speech-to-text-client

Usage

import asyncio
from tomfun_speech_to_text_client import Client

async def main():
    async with Client("https://speech-to-text.tomfun.co", token="YOUR_TOKEN") as c:
        r = await c.transcribe_file("audio.mp3", language="en")
        print(r.text)

        r = await c.transcribe_url("https://example.com/clip.wav", language="uk")
        print(r.srt)

asyncio.run(main())

With progress callback:

async def on_status(ev):
    print(ev["status"], ev.get("progressLast"))

await c.transcribe_file("audio.mp3", language="en", on_status=on_status)

Cancel a job:

await c.cancel(job_id)

Development (uv)

cd python_client
uv sync --group dev
uv run pytest

Publishing to PyPI

  1. Create a PyPI API token at https://pypi.org/manage/account/token/.
  2. Bump version in pyproject.toml.
  3. Build:
    uv build
    
  4. Upload:
    uv publish --token "$PYPI_TOKEN"
    
    Or via twine:
    uv tool run --with twine twine upload dist/*
    

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

tomfun_speech_to_text_client-0.0.2.tar.gz (93.8 kB view details)

Uploaded Source

Built Distribution

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

tomfun_speech_to_text_client-0.0.2-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file tomfun_speech_to_text_client-0.0.2.tar.gz.

File metadata

  • Download URL: tomfun_speech_to_text_client-0.0.2.tar.gz
  • Upload date:
  • Size: 93.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"21.3","id":"virginia","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for tomfun_speech_to_text_client-0.0.2.tar.gz
Algorithm Hash digest
SHA256 24f3a8e4b0246b19ff40df2b72f397749149ecc0a4796c0a1e3acf1f1f7296e7
MD5 cd764b4efafdff8caab3240b660efa4c
BLAKE2b-256 becd4e25e5d6b73a281cda5f36e732e1ab5c4dad346de7493a8042c5bfa8152b

See more details on using hashes here.

File details

Details for the file tomfun_speech_to_text_client-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: tomfun_speech_to_text_client-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"21.3","id":"virginia","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for tomfun_speech_to_text_client-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1db11f2dc970572a248c948d4ea2808cada4e7a6b68a1d93d98baa843cc752a5
MD5 814f7c1c718e2ba2dcc4249fcf14cee4
BLAKE2b-256 2e3bb464a882b50a1f3e54c403fc0f42d70ee2ab3dd3fa1168c5c0dfd4af6b3e

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