Client

class

gworker_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

python
1class Client

Methods

from_env

python
1from_env() -> Client

Build a client from the credentials saved by `gworker login`. Reads GWORKER_TOKEN from the environment, falling back to ~/.gworker/credentials.

from_credentials

python
1from_credentials(creds: Credentials) -> Client

Build a client from an explicit Credentials value. Use this in tests or when you need to inject credentials programmatically.

close

python
1close() -> None

Close the underlying HTTP session and release connection pool resources. Call this when done, or use Client as a context manager.

list_apps

python
1list_apps() -> list[dict[str, Any]]

Return all apps in the tenant. Each dict includes name, region, and stage metadata.

get_app

python
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

python
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

python
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

python
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.

← Back to docs