Skip to main content

VWO OpenFeature Provider Python

Project description

VWO OpenFeature Provider Python

PyPI version License

Requirements

  • Works with Python: 3.8+

Installation

It's recommended you use virtualenv to create isolated Python environments.

pip install vwo-openfeature-provider-python

Usage

from openfeature import api
from vwo_provider.vwo_provider import VWOProvider
from openfeature.evaluation_context import EvaluationContext
from vwo import init

options = {
    'sdk_key': '32-alpha-numeric-sdk-key', # SDK Key
    'account_id': '123456' # VWO Account ID
}

# Initialize the VWO client
vwo_client = init(options)

# Initialize the VWO provider
vwo_provider = VWOProvider(vwo_client)

# Registering the default provider
api.set_provider(vwo_provider)

# A client bound to the default provider
default_client = api.get_client()

def start():
    print('BOOL', default_client.get_boolean_value('unique_feature_key', False, EvaluationContext(attributes={'id': 'user_id', 'key': 'boolean_variable'})))
    print('STRING', default_client.get_string_value('unique_feature_key', '', EvaluationContext(attributes={'id': 'user_id', 'key': 'string_variable'})))
    print('INTEGER', default_client.get_integer_value('unique_feature_key', 10, EvaluationContext(attributes={'id': 'user_id', 'key': 'number_variable'})))
    print('FLOAT', default_client.get_float_value('unique_feature_key', 10.0, EvaluationContext(attributes={'id': 'user_id', 'key': 'float_variable'})))
    print('OBJECT', default_client.get_object_value('unique_feature_key', {}, EvaluationContext(attributes={'id': 'user_id', 'key': 'json-variable'})))

start()

Authors

Changelog

Refer CHANGELOG.md

Contributing

Please go through our contributing guidelines

Code of Conduct

Code of Conduct

License

Apache License, Version 2.0

Copyright 2024 Wingify Software Pvt. Ltd.

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

File details

Details for the file vwo_openfeature_provider_python-1.0.0.tar.gz.

File metadata

File hashes

Hashes for vwo_openfeature_provider_python-1.0.0.tar.gz
Algorithm Hash digest
SHA256 51c008dfd6d797b4ea39347b82a9516dba7bd4b0fca5bef02bdcfba79c91e250
MD5 18efdd1f2c4da3b89a4fc02b801d3d6d
BLAKE2b-256 a3fdcbe4b7ea673a17ab71f046cb8f87ac15b8506d99393a23c9e4a212645256

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