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).
Parameters
id: str
command: Optional[str]
cwd: Optional[str]
env: Optional[Dict[str, str]]
timeout_seconds: Optional[int]
Returns
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)