Python
Official async Python SDK.
Install
bash
pip install servermeRequires Python 3.9+ and aiohttp.
Quick start
python
import asyncioasync def main(): async with Deployzy(authtoken="sm_live_...") as client: tunnels = await client.tunnels.list() requests = await client.inspect.list(tunnels[0].url)
for req in requests: print(f"{req.method} {req.path} -> {req.status_code}")
asyncio.run(main()) ```
Live traffic
python
async with Deployzy(authtoken="sm_live_...") as client:
async for req in client.inspect.subscribe(tunnel_url):
print(f"{req.method} {req.path} -> {req.status_code}")Deploy a project
python
async with Deployzy(authtoken="sm_live_...") as client:
# Build from a repo (or pass image="nginx:alpine" to run a prebuilt image)
project = await client.projects.create(
name="api", subdomain="api", repo="you/api",
env={"NODE_ENV": "production"},
)
await client.projects.deploy(project.id)
final = await client.projects.wait_for_deploy(project.id)
print(final.status) # "running" or "failed"API keys
python
keys = await client.api_keys.list()
full_token, info = await client.api_keys.create("my-app")
await client.api_keys.delete(info.id)Error handling
python
try: await client.tunnels.list() except AuthError: print("Bad token") except RateLimitError as e: print(f"Retry in {e.retry_after}s") ```
Self-hosted
python
client = Deployzy(
authtoken="sm_live_...",
server_url="https://api.yourdomain.com",
)