Client
classgworker_client.client.Client
Opaque HTTP session against a gworker gateway. Wraps authentication, retries, and all REST calls. Prefer the CLI for interactive use; use Client directly in scripts or CI pipelines.
Class
1class ClientMethods
from_env
1from_env() -> ClientBuild a client from the credentials saved by `gworker login`. Reads GWORKER_TOKEN from the environment, falling back to ~/.gworker/credentials.
from_credentials
1from_credentials(creds: Credentials) -> ClientBuild a client from an explicit Credentials value. Use this in tests or when you need to inject credentials programmatically.
close
1close() -> NoneClose the underlying HTTP session and release connection pool resources. Call this when done, or use Client as a context manager.
list_apps
1list_apps() -> list[dict[str, Any]]Return all apps in the tenant. Each dict includes name, region, and stage metadata.
get_app
1get_app(name: str) -> dict[str, Any]Fetch a single app by name. Raises NotFoundError if the app does not exist in the tenant.
deploy
1deploy(name: str, tarball: bytes, stage: str = 'dev') -> dict[str, Any]Upload a source tarball and trigger a deploy to the given stage. The CLI calls this under the hood; you can call it directly for programmatic deploys from CI.
promote
1promote(name: str, from_stage: str, to_stage: str) -> dict[str, Any]Promote an app from one stage to another (dev → uat, uat → prod). The current image and graph of from_stage are promoted; no re-build occurs.
stream_logs
1stream_logs(name: str, stage: str = 'dev')Stream live NDJSON log frames from a running app. Each frame is a dict with stream (stdout/stderr/info/error) and line keys. Yields until the connection drops.