Python SDK
Async-first Python client for the Halo REST API.
halo-sdk is an async Python client built on httpx. Sync wrappers exist for scripts, but async is the primary surface.
Install
uv add halo-sdkOr with pip:
pip install halo-sdkAuthenticate
import os
from halo import Halo
halo = Halo(token=os.environ["HALO_TOKEN"])Deploy
import asyncio
from halo import Halo
async def main():
halo = Halo()
dep = await halo.deployments.create(
project_id="prj_abc123",
files={"index.html": "abc...", "app.js": "def..."},
target="production",
)
print(dep.url)
asyncio.run(main())Iterate deployments
async for dep in halo.deployments.list(project_id="prj_abc123"):
print(dep.id, dep.status)The iterator transparently follows pagination cursors.
Streaming logs
async with halo.logs.stream(project_id="prj_abc123") as stream:
async for line in stream:
print(line.timestamp, line.message)Sync API
For one-off scripts:
from halo.sync import Halo
halo = Halo()
dep = halo.deployments.get("dpl_x7k2qz")
print(dep.url)Errors
from halo import HaloError
try:
await halo.deployments.get("dpl_does_not_exist")
except HaloError as err:
if err.code == "deployment_not_found":
...
raiseHaloError exposes code, message, doc_url, and request_id for support tickets.
Last updated
Edit this page