Python SDK
Thread-safe client for evaluating feature flags in Python applications.
Installation
bash
pip install featuresignalsRequirements: Python 3.9+
Quick Start
python
from featuresignals import FeatureSignalsClient, ClientOptions, EvalContext
client = FeatureSignalsClient(
"fs_srv_your_api_key",
ClientOptions(env_key="production", base_url="https://api.featuresignals.com"),
)
client.wait_for_ready()
ctx = EvalContext(key="user-123", attributes={"country": "US"})
enabled = client.bool_variation("new-feature", ctx, False)
print(f"Feature enabled: {enabled}")
client.close()Configuration Options
| Option | Type | Default |
|---|---|---|
env_key | str | (required) |
base_url | str | https://api.featuresignals.com |
polling_interval | float | 30.0 |
streaming | bool | False |
timeout | float | 10.0 |
Variation Methods
python
# Boolean
enabled = client.bool_variation("flag-key", ctx, False)
# String
theme = client.string_variation("theme", ctx, "light")
# Number
limit = client.number_variation("rate-limit", ctx, 100)
# JSON
config = client.json_variation("feature-config", ctx, {})