Official Python SDK for the Hadidy Audio Transcoding API
Project description
hadidy-audio
Official Python SDK for the Hadidy Audio Transcoding API. Supports Python 3.10+ with both synchronous and asynchronous clients.
Installation
pip install hadidy-audio
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())
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"]["job_id"])
return {"ok": True}
API Coverage
| Resource | Sync | Async |
|---|---|---|
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 |
Full session management, sources, recordings | ✓ |
Error Handling
from hadidy import AudioClient, RateLimitError, NotFoundError, 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 HadidyError as e:
print(f"API error {e.status}: {e}")
Configuration
client = AudioClient(
api_key="had_live_...",
base_url="https://api.hadidy.com", # default
timeout=30.0, # default: 30s
max_retries=2, # default: 2
)
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hadidy_audio-0.1.0.tar.gz
(9.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hadidy_audio-0.1.0.tar.gz.
File metadata
- Download URL: hadidy_audio-0.1.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2c580cc415b565d943b1b01bd40c612611a8dc08dc58fe314b71e9c99c9b0d3
|
|
| MD5 |
e5c57f62b7259e565965827e5cd22026
|
|
| BLAKE2b-256 |
78ac78870c11fa113be737f033e0960ac17b557202edfe0534f80bb35c8bf3dc
|
File details
Details for the file hadidy_audio-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hadidy_audio-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb052d6015e07925a7c6a1ba2f9e1921fccf39534194a882d98924f261617468
|
|
| MD5 |
36080f8e4939dbd980d783797f77e613
|
|
| BLAKE2b-256 |
02e225d3792267c962e564a713952beb01d621ca6b9ffd8ad23a4e3d77dbc6df
|