Skip to content
Dashboard

Execute command (streaming)

computers.exec.create(strid, ExecCreateParams**kwargs) -> ExecCreateResponse
POST/computers/{id}/exec

Execute a shell command with real-time streaming output as NDJSON. Each line is a JSON object with type (stdout/stderr/exit/error).

ParametersExpand Collapse
id: str
command: Optional[str]
cwd: Optional[str]
env: Optional[Dict[str, str]]
timeout_seconds: Optional[int]
ReturnsExpand Collapse
class ExecCreateResponse:
code: Optional[int]

for exit

data: Optional[str]

for stdout/stderr

message: Optional[str]

for error

type: Optional[str]

"stdout", "stderr", "exit", "error"

Execute command (streaming)

import os
from tzafon import Lightcone

client = Lightcone(
    api_key=os.environ.get("TZAFON_API_KEY"),  # This is the default and can be omitted
)
for exec in client.computers.exec.create(
    id="id",
):
  print(exec)
Returns Examples