Skip to main content

Harness.io Python Configs Client

Project description

Harness FME Python Configs SDK

Overview

Harness FME Python Configs SDK is designed to serve standalone, versioned configuration objects in Python applications.

Compatibility

This SDK is compatible with Python 3.7 and higher.

Getting started

Below is a simple example that describes the instantiation and most basic usage of our SDK:

Run pip install splitio_configs_client

from splitio_configs import ConfigsClient, TimeoutException, Target

client = ConfigsClient('YOUR_SDK_KEY')
try:
    client.block_until_ready()
except TimeoutException:
    # SDK_READY_TIMED_OUT: evaluations will return the fallback config or a Config with variant "control".
    pass

# Without target: returns the default variant of the config
default_config = client.get_config('CONFIG_NAME')
print(default_config.variant)  # example: 'v1'
print(default_config.value)    # example: {'prompt': 'Hello world', 'temperature': 0.5}

# With target: evaluates targeting rules for the given key
target = Target('user-123')
config = client.get_config('CONFIG_NAME', target)
print(config.variant, config.value)

The SDK also support asyncio, see below example:

from splitio_configs import ConfigsClientAsync, TimeoutException, Target

async def main():
    client = ConfigsClientAsync('YOUR_SDK_KEY')
    try:
        await client.block_until_ready()
    except TimeoutException:
        # SDK_READY_TIMED_OUT: evaluations will return the fallback config or a Config with variant "control".
        pass

    # Without target: returns the default variant of the config
    default_config = await client.get_config('CONFIG_NAME')
    print(default_config.variant)  # example: 'v1'
    print(default_config.value)    # example: {'prompt': 'Hello world', 'temperature': 0.5}

    # With target: evaluates targeting rules for the given key
    target = Target('user-123')
    config = await client.get_config('CONFIG_NAME', target)
    print(config.variant, config.value)

asyncio.run(main())

Please refer to our official docs to learn about all the functionality provided by our SDK and the configuration options available for tailoring it to your current application setup.

Submitting issues

The Split team monitors all issues submitted to this issue tracker. We encourage you to use this issue tracker to submit any bug reports, feedback, and feature enhancements. We'll do our best to respond in a timely manner.

License

Licensed under the Apache License, Version 2.0. See: Apache License.

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

splitio_configs-1.0.0b1.tar.gz (24.9 kB view details)

Uploaded Source

File details

Details for the file splitio_configs-1.0.0b1.tar.gz.

File metadata

  • Download URL: splitio_configs-1.0.0b1.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for splitio_configs-1.0.0b1.tar.gz
Algorithm Hash digest
SHA256 ff0c97d114ae766626255f493ec968d748d3eb0981534308cc48b9ddd3b04233
MD5 138bd5468dbd66be08fa2a21ce4356ce
BLAKE2b-256 4313ac98d2715b15ed9146225cb6dbe8753fcddc43ba617b11914171cb20e110

See more details on using hashes here.

Supported by

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