Skip to content

Async client

Use asynchronous SDK calls in JavaScript and Python.

JavaScript SDK calls return promises. Python includes a native async client with the same resource layout as the sync SDK. Both support asynchronous iteration over paginated resources.

async.jsasync.py
import StackMachine from "stackmachine";

const client = new StackMachine(process.env.STACKMACHINE_API_TOKEN);
for await (const app of client.apps.list({ limit: 10 })) {
  console.log(app.id, app.name);
}
import asyncio
import os
from stackmachine import AsyncStackMachine

async def main():
    async with AsyncStackMachine(os.environ["STACKMACHINE_API_TOKEN"]) as client:
        async for app in client.apps.list(limit=10):
            print(app.id, app.name)

asyncio.run(main())

Source: stackmachine/sdks examples.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close