SDKs

Python

Official async Python SDK.

Install

pip install deployzy

Requires Python 3.9+ and aiohttp.

Quick start

import asynciofrom deployzy import Deployzyasync 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

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

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

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

from deployzy import AuthError, RateLimitErrortry:    await client.tunnels.list()except AuthError:    print("Bad token")except RateLimitError as e:    print(f"Retry in {e.retry_after}s")

Custom API URL

client = Deployzy(    authtoken="sm_live_...",    server_url="https://api.deployzy.com",  # the default)

Was this page helpful?