Projects

envless.projects.iterate()

Stream projects one row at a time

def iterate(
    *,
    limit: int | None = None,
    offset: int | None = None,
    search: str | None = None,
    order: str | None = None,
    product: str | None = None,
    timeout: float | None = None,
) -> Iterator[ProjectResource]

Yields projects individually, fetching the next page only once the current one is drained. This keeps memory flat over large workspaces and lets you stop early.

It returns an iterator, so put the call straight into a for loop, or an async for loop on AsyncEnvless. No request is issued until the first iteration, and breaking out of the loop leaves the remaining pages unfetched.

Example

from envless import envless

for project in envless.projects.iterate(product='billing'):
    print(project['slug'])

Parameters

ParameterTypeRequiredDescription
productstrNoProduct slug or product uniqueId to restrict the stream to one product.
limitintNoPage size fetched behind the scenes, clamped to 100.
offsetintNoRow to start streaming from.
searchstrNoCase insensitive substring match against project name and slug.
orderstrNoDefaults to name, which sorts A to Z. Pass asc for oldest first or desc for newest first on createdAt.
timeoutfloatNoSeconds each attempt of this call may take, the response body included, before it raises EnvlessNetworkError with is_timeout set. Overrides the client's timeout for this call, and 0 turns the limit off.

Returns

An iterator that yields ProjectResource values until the pages run out.

Reads the projects collection. list returns one page as a dict with items and pagination, list_all collects every page into a list, and iterate yields one item at a time, fetching the next page only when the loop reaches it. On AsyncEnvless, iterate is an async iterator for async for.

Worth knowing

  • The offset advances by the number of rows actually received, so projects created mid walk can shift the window.
  • Use this rather than list_all when you only need the first match, since it stops fetching the moment you break.

Required scopes

projects:read

Underlying endpoint

GET /projects

Request and response schema, every error code, and a live playground.

In TypeScript

envless.projects.iterate()

The same method in @goenvless/sdk, with the same request, retries and errors.