Skip to content

v0.7.0 — Flux Writes & Typed Write Errors

Choose a tag to compare

@loookashow loookashow released this 22 Jul 18:08

Release notes:

This release adds write support to the Flux client and aligns the error and usage types with the current delivery API.

Highlights

Flux writes

  • FluxClient.create_resource(folder_path, data, *, key=None) and the async AsyncFluxClient.create_resource(...) — create and publish a resource immediately. key is an optional external identifier for deduplication.
  • update_resource(folder_path, resource_key, data) (sync + async) — a full-document replace that publishes a new revision (not a partial merge).
  • Both accept nested collection paths, e.g. users/usr_1/memories.
  • Returns resource_key, revision_key, write_units, published.
created = client.create_resource("articles", {"title": "Hello"}, key="my-id")
client.update_resource("articles", created["resource_key"], {"title": "Hello (edited)"})

Typed errors

New subclasses of FoxnoseAPIError (exported from the package root, still caught by except FoxnoseAPIError):

  • CollectionNotWritable (403)
  • ExternalIdConflict (409)
  • ContentValidationFailed (422) — exposes .errors (each with a json_path) and .errors_truncated
  • UpstreamError (502) — the write outcome is unknown

Reliability

  • Writes are never retried automatically. A failed write's outcome is unknown, so on failure re-read with a GET before retrying. (Backed by a new per-request allow_retries flag on the transport, defaulting to True for reads.)

Misc

The default User-Agent now reports the real package version.

Breaking changes

  • UsageBreakdown now exposes projects, resources, and users (previously also environments, folders, and components). Parsing stays forward-compatible with additional server fields.

Install

pip install --upgrade foxnose-sdk