Skip to main content

hadidy-audio

Official Python SDK for the Hadidy Audio Transcoding API. Supports Python 3.10+ with both synchronous and asynchronous clients. Zero required dependencies beyond httpx and pydantic.

Installation

pip install hadidy-audio

Python 3.10+ required. The async client uses asyncio — no extra install needed.


Quick Start — Synchronous

from hadidy import AudioClient

client = AudioClient(api_key="had_live_...")

with open("podcast.wav", "rb") as f:
    job = client.jobs.create(f, output_format="mp3", bitrate="192k")

completed = client.jobs.wait_for_completion(job["id"], timeout=300)
print(completed["output_url"])

Quick Start — Async

import asyncio
from hadidy import AsyncAudioClient

async def main():
    async with AsyncAudioClient(api_key="had_live_...") as client:
        async for job in client.jobs.list_all(status="completed"):
            print(f"{job['file_name']} → {job['output_url']}")

asyncio.run(main())

Live Streaming

from hadidy import AudioClient

client = AudioClient(api_key="had_live_...")

# Create a session — WHIP is the default protocol
session = client.live.create_session(
    title="Friday Night Show",
    ingest_protocol="whip",   # default; can be omitted
    recording_enabled=True,
)
client.live.start_session(session["id"])

print("WHIP endpoint:", session["ingest_url"])
# → https://ingest.hadidy.com/{stream_key}/whip

# OBS 30+: Settings → Stream → Service: WHIP
#   Server: paste session["ingest_url"]  (no separate stream key field)

RTMPS (OBS older / vMix / Streamlabs)

session = client.live.create_session(
    title="Friday Night Show",
    ingest_protocol="rtmp",   # externally TLS-encrypted RTMPS on port 4936
    recording_enabled=True,
)
client.live.start_session(session["id"])

print("RTMPS server:", session["ingest_url"])  # rtmps://rtmps.hadidy.com:4936/
print("Stream key:  ", session["stream_key"])

# OBS: Settings → Stream → Service: Custom RTMPS
#   Server:     paste session["ingest_url"]
#   Stream Key: paste session["stream_key"]

Push track metadata mid-stream

# Call on every track change in your DJ software
client.live.update_now_playing(
    session["id"],
    title="Midnight City",
    artist="M83",
    album="Hurry Up, We're Dreaming",
    cover_url="https://example.com/artwork.jpg",
    # Pre-load the upcoming track on listeners' devices:
    next_title="Resonance",
    next_artist="Home",
    next_cover_url="https://example.com/next-artwork.jpg",
)

# Clear track info between sets
client.live.clear_now_playing(session["id"])

Stop and retrieve recordings

client.live.stop_session(session["id"])

recordings = client.live.list_recordings(session["id"])
for r in recordings:
    print(r["download_url"], r["duration_seconds"])

Async live session

import asyncio
from hadidy import AsyncAudioClient

async def broadcast():
    async with AsyncAudioClient(api_key="had_live_...") as client:
        session = await client.live.create_session(title="Night Show", ingest_protocol="whip")
        await client.live.start_session(session["id"])
        print("Streaming at:", session["ingest_url"])

        # Later, on track change:
        await client.live.update_now_playing(session["id"], title="Atlas", artist="Battles")

        # Stop when done
        await client.live.stop_session(session["id"])

asyncio.run(broadcast())

Webhook Verification — FastAPI

from hadidy import WebhookVerifier
from fastapi import FastAPI, Request, HTTPException, Depends
import os

app = FastAPI()
verifier = WebhookVerifier(secret=os.environ["HADIDY_WEBHOOK_SECRET"])

@app.post("/hooks/hadidy")
async def webhook(request: Request, _=Depends(verifier.fastapi_dependency())):
    event = await request.json()
    print(event["type"], event["data"])
    return {"ok": True}

API Coverage

Resource Methods
client.jobs list(), list_all(), get(), create(), delete(), get_output(), wait_for_completion()
client.presets list(), list_all(), get(), create(), update(), delete()
client.codecs list_codecs(), list_formats(), capabilities()
client.analysis analyze(file)
client.audio waveform_data(), silence(), get_metadata(), update_metadata(), concat()
client.webhooks list(), get(), create(), update(), delete(), deliveries(), test()
client.billing balance(), history(), service_costs()
client.folders list(), get(), breadcrumb(), create(), update(), delete(), move_files()
client.sharing list(), get(), create(), update(), delete(), get_public_info(), verify_passcode()
client.live create_session(), get_session(), list_sessions(), list_sessions_all(), update_session(), start_session(), stop_session(), restart_session(), delete_session(), regenerate_key(), update_now_playing(), clear_now_playing(), list_sources(), add_source(), list_participants(), list_recordings()

All methods have async equivalents on AsyncAudioClient.


Error Handling

from hadidy import AudioClient, RateLimitError, NotFoundError, ValidationError, HadidyError

client = AudioClient(api_key="had_live_...")

try:
    job = client.jobs.get("nonexistent-id")
except NotFoundError:
    print("Job not found")
except RateLimitError as e:
    print(f"Rate limited — retry after {e.retry_after}s")
except ValidationError as e:
    print(f"Bad request: {e}")
except HadidyError as e:
    print(f"API error {e.status}: {e}")

Configuration

client = AudioClient(
    api_key="had_live_...",              # required
    base_url="https://api.hadidy.com",   # default
    timeout=30.0,                         # seconds — default: 30.0
    max_retries=2,                        # default: 2
)

License

MIT

Metadata

Release files for hadidy-audio 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hadidy-audio 0.1.2
File Size Uploaded Provenance Actions
hadidy_audio-0.1.2.tar.gz 10.6 kB Without provenance Details for hadidy_audio-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hadidy-audio 0.1.2
File Interpreter ABI Platform Actions
hadidy_audio-0.1.2-py3-none-any.whl Python 3 none any Details for hadidy_audio-0.1.2-py3-none-any.whl

Total release size: 27.3 kB

Release files / hadidy_audio-0.1.2.tar.gz

Download URL hadidy_audio-0.1.2.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
40a1f1b677808f3980f8aed80e36e1c576cce44ddb0a07510b1792eda2f2542b
BLAKE2b-256 checksum
How to use checksums
feb8edc4e36632f53d5e074f8a122195d6cf1f4a6e3303a9d4f7fcce4d048b8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release files / hadidy_audio-0.1.2-py3-none-any.whl

Download URL hadidy_audio-0.1.2-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a12ce2249906dcbc7a234d433e7fcd6318028a727b347dbe1fbd934d8773051a
BLAKE2b-256 checksum
How to use checksums
7280701aee7a5ea9175fdf604c4c5be3bc27a85c49694543ef3edc9095afc2e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Security for hadidy-audio 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page