A client for the Unleash feature toggle system.
UnleashClient.__init__(url, app_name, instance_id, refresh_interval, metrics_interval, disable_metrics, custom_headers)
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 | {} |
cache_directory | Location of the cache directory. When unset, FCache will determine the location | N | Str | Unset |
Initializes client and starts communication with central unleash server(s).
This kicks off:
- Client registration
- Provisioning poll
- Stats poll
Gracefully shuts down the Unleash client by stopping jobs, stopping the scheduler, and deleting the cache.
You shouldn't need this too much!
Checks if a feature toggle is enabled.
Notes:
- If client hasn't been initialized yet or an error occurs, flat will default to false.
UnleashClient.is_enabled(feature_name, context, default_value)
Arguments
Argument | Description | Required? | Type | Default Value |
---|---|---|---|---|
feature_name | Name of feature | Y | String | N/A |
context | Custom information for strategies | N | Dictionary | {} |
default_value | Default value of feature. | N | Boolean | F |