InvergeDocs
PythonAPI reference

Feature flags

Feature flags — evaluate the environment's active flags for one person.

// access
client.flags

Feature flags — evaluate the environment's active flags for one person.

Flags

class

client.flags

Every helper performs one evaluation call. When you need several flags for the same user, call evaluate once and ask the result:

flags = client.flags.evaluate("user_1", {"plan": "pro"})
if flags.is_enabled("new_checkout"):
    ...
theme = flags.payload("paywall")

Extends Resource.

View source

evaluate()

method
def evaluate(distinct_id=None, properties=None, **extra_properties) -> FlagEvaluation

Evaluate every active flag for a person.

distinct_id falls back to the ambient nexus.context.

Parameters

Prop

Type

Returns FlagEvaluation

View source

all()

method
def all(distinct_id=None, properties=None, **extra_properties) -> Mapping[str, Any]

Flat {key: bool | variant} map.

Parameters

Prop

Type

Returns Mapping[str, Any]

View source

is_enabled()

method
def is_enabled(key, distinct_id=None, properties=None, *, default=False, **extra_properties) -> bool

Whether a flag is on, or default if it can't be evaluated.

Parameters

Prop

Type

Returns bool

View source

variant()

method
def variant(key, distinct_id=None, properties=None, *, default=None, **extra_properties) -> Optional[str]

The resolved variant of a multivariate flag, else default.

Parameters

Prop

Type

Returns Optional[str]

View source

payload()

method
def payload(key, distinct_id=None, properties=None, *, default=None, **extra_properties) -> Any

The flag's attached JSON payload, or default.

default is keyword-only so a third positional argument can't be mistaken for it — that slot is the targeting properties.

Parameters

Prop

Type

Returns Any

View source

On this page