Skip to content

spotify/confidence-sdk-python

Python Confidence SDK

Python library for Confidence.

Install

pip install

pip install spotify-confidence-sdk==0.2.6

#### requirements.txt
```python
spotify-confidence-sdk==0.2.6

pip install -r requirements.txt

Usage

Resolving flags

Flag values are evaluated remotely and returned to the application:

from confidence.confidence import Confidence

root_confidence = Confidence("CLIENT_TOKEN")
confidence = root_confidence.with_context({"user_id": "some-user-id"})
default_value = False
flag_details = confidence.resolve_boolean_details("flag-name.property-name", default_value)
print(flag_details)

Tracking events

Events are emitted to the Confidence backend:

confidence.track("event_name", {
	"field_1": False
})

OpenFeature

The library includes a Provider for the OpenFeature Python SDK, that can be used to resolve feature flag values from the Confidence platform.

To learn more about the basic concepts (flags, targeting key, evaluation contexts), the OpenFeature reference documentation can be useful.