Versions

envless.versions.iterate_entries()

Stream version entries one at a time

def iterate_entries(
    project: str,
    environment: str,
    *,
    limit: int | None = None,
    offset: int | None = None,
    product: str | None = None,
    timeout: float | None = None,
) -> Iterator[VersionEntryResource]

Yields version entries individually, fetching the next page only once the current one is drained. Use it to rotate a large environment without holding its whole encrypted history in memory.

It returns an iterator, so put the call straight into a for loop, or an async for loop on AsyncEnvless. reencrypt_entries rewrites only value and defaultValue and never adds or removes rows, so writing back mid stream does not shift the window. Publishing a version mid walk does shift it, because the new entries land in the same flat set.

Example

from envless import envless

encrypted = 0

for entry in envless.versions.iterate_entries(
    'api', 'production'
):
    if entry['value']:
        encrypted += 1

print(encrypted)

Parameters

ParameterTypeRequiredDescription
projectstrYesProject slug or project uniqueId.
environmentstrYesEnvironment slug, since an environment uniqueId will not resolve here.
productstrNoProduct slug used to disambiguate a project slug shared across products.
limitintNoPage size fetched behind the scenes, clamped to 100.
offsetintNoRow to start streaming from.
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 VersionEntryResource values until the pages run out.

Reads the entries 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

  • Buffer the yielded entries and write them back in batches. One reencrypt_entries call per entry works but costs a request each.
  • Freeze publishing while a rotation walk is in flight, otherwise a new version adds entries encrypted under the old key after you have already passed that offset.

Required scopes

versions:read and variables:read

Underlying endpoint

GET /projects/{slug}/environments/{environmentSlug}/versions/entries

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

In TypeScript

envless.versions.iterateEntries()

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