Python client for the Unleash feature toggle system!
Project description
unleash-client-python
This is the Python client for Unleash. It implements Client Specifications 1.0 and checks compliance based on spec in unleash/client-specifications
What it supports:
- Default activation strategies using 32-bit Murmerhash3
- Custom strategies
- Full client lifecycle:
- Client registers with Unleash server
- Client periodically fetches feature toggles and stores to on-disk cache
- Client periodically sends metrics to Unleash Server
Check out the project documentation here.
Installation
Check out the package on Pypi!
pip install UnleashClient
Usage
Initialization
from UnleashClient import UnleashClient
client = UnleashClient("https://unleash.herokuapp.com/api", "My Program")
client.initialize_client()
To clean up gracefully:
client.destroy()
Arguments
| Argument | Description | Required? | Type | Default Value |
|---|---|---|---|---|
| url | Unleash server URL | Y | String | N/A |
| app_name | Name of your program | Y | String | N/A |
| instance_id | Unique ID for your program | N | String | unleash-client-python |
| refresh_interval | How often the unleash client should check for configuration changes. | N | Integer | 15 |
| metrics_interval | How often the unleash client should send metrics to server. | N | Integer | 60 |
| disable_metrics | Disables sending metrics to Unleash server. | N | Boolean | F |
| custom_headers | Custom headers to send to Unleash. | N | Dictionary | {} |
| custom_strategies | Custom strategies you'd like UnleashClient to support. | N | Dictionary | {} |
Checking if a feature is enabled
A check of a simple toggle:
client.is_enabled("My Toggle")
Specifying a default value:
client.is_enabled("My Toggle", default_value=True)
Supplying application context:
app_context = {"userId": "test@email.com"}
client.is_enabled("User ID Toggle", app_context)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file UnleashClient-2.2.0.tar.gz.
File metadata
- Download URL: UnleashClient-2.2.0.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f40633b2cec7b80c2eb8ba46dd351cc3d44ba105f7fc4d8a41605e48d76e8106
|
|
| MD5 |
542652c2a9108abfe662e9dae2b2e1d8
|
|
| BLAKE2b-256 |
298b2638d64e6f5a3f29d39fe475697f502eb8e499319ba5ba99510f626002d4
|
File details
Details for the file UnleashClient-2.2.0-py3-none-any.whl.
File metadata
- Download URL: UnleashClient-2.2.0-py3-none-any.whl
- Upload date:
- Size: 35.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1841a3cdeffd8ccfe55222bba6f69a65e2ec9dca80b58c49e4f558e764630806
|
|
| MD5 |
53f883c163f9edae4e6ed5f3a7418c79
|
|
| BLAKE2b-256 |
daede0135db87987e0496769cb06eaaa01e45758c38130247696787e0dccdff8
|