Skip to main content

Confidence provider for the OpenFeature SDK

Project description

Confidence SDK

This repo contains the Confidence SDK for python and the Confidence OpenFeature flag provider.

Adding the dependency

pip install

pip install spotify-confidence-sdk==0.2.4

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

pip install -r requirements.txt

Creating and using the flag provider

Below is an example for how to initialize the Confidence SDK, and then resolve a flag with a boolean attribute. The SDK is configured with an api key, which will authorize the resolving requests.

The flag will be applied immediately, meaning that Confidence will count the targeted user as having received the treatment.

You can retrieve attributes on the flag variant using property dot notation, meaning test-flag.boolean-key will retrieve the attribute boolean-key on the flag test-flag.

You can also use only the flag name test-flag and retrieve all values as a map with resolve_object_details().

The flag's schema is validated against the requested data type, and if it doesn't match it will fall back to the default value.

from confidence.confidence import Confidence
from confidence.confidence import Region

confidence = Confidence("API_KEY")
# to send an event
confidence.with_context({"app": "python"}).track("event_name", {})
#to resolve a flag
default_value = False
flag_value = confidence.resolve_boolean_details("test-flag.boolean-key", default_value)
print(flag_value)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spotify_confidence_sdk-0.2.4.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

spotify_confidence_sdk-0.2.4-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file spotify_confidence_sdk-0.2.4.tar.gz.

File metadata

File hashes

Hashes for spotify_confidence_sdk-0.2.4.tar.gz
Algorithm Hash digest
SHA256 0e13d92b3279ecdf28c657a8caf83790860ef34fa2cd4bd4488b629f45a1a615
MD5 5f22d1710a5187a236e931a30fbeeb9f
BLAKE2b-256 ca8023246cbb49699f731d1ce04d4fb3639017a7ff7d7f7ec52077d53a4dbe76

See more details on using hashes here.

File details

Details for the file spotify_confidence_sdk-0.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for spotify_confidence_sdk-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8016f5f4c8871ca28e0715768ecd688d7d567f134e1ba1741bef66853bc5e961
MD5 a67acf176042bf94589627d3c2ab4303
BLAKE2b-256 e512bad54302276d161fa56599f5b2c039e11b7f3290f3ba29746197b64fd808

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page