Python client for FeatureSwitches.com
Project description
A Python package for interacting with FeatureSwitches.com. This library is under active development and is likely to change frequently. Bug reports and pull requests are welcome.
Installation
pip install featureswitches
Usage
fs = FeatureSwitches('customer_api_key', 'environment_api_key')
# Ensure that the API credentials are valid
result = fs.authenticate() # result will be true/false to indicate success
# Add a user
result = fs.add_user('user_identifier', 'optional_customer_identifier', 'optional_name', 'optional_email')
# Check if a feature is enabled
result = fs.is_enabled('feature_key', 'optional_user_identifier', default_return_value(true/false, default=false))
if result:
# Feature enabled, do something
else:
# Feature disabled, do something else
Configuration Options
A few options are available to be tweaked if you so choose. The library makes use of a local cache to minimize requests back to the FeatureSwitches server. Additionally, a check it performed at an interval to automatically re-sync feature state when changes are made in the dashboard.
cache_timeout=SECONDS # Defaults to 300 seconds
check_interval=SECONDS # Defaults to 10 seconds
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/featureswitches/featureswitches-python.
License
The library is available as open source under the terms of the MIT 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 Distributions
Built Distribution
Hashes for featureswitches-0.8.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ecf1fd2ee77324f45acd485161f1416a197cce3f9a2403d18bf99facc96cab37 |
|
MD5 | 861c4df9583cc01f5ae023fca2dfa120 |
|
BLAKE2b-256 | 253d40a7dfcc3eb27f50261b5f43158b1ef65ce63e7573eb3ffd09d148bd6555 |