Flipt Client Python SDK
raw JSON → 1.4.1 verified Fri May 01 auth: no python
Python client for Flipt feature flag evaluation. Version 1.4.1 supports synchronous and asynchronous evaluation via REST and gRPC. Active development with monthly releases.
pip install flipt-client Common errors
error flipt_client.exceptions.FliptClientError: Failed to connect to remote host ↓
cause Flipt server not running or wrong URL/port.
fix
Start the Flipt server and double-check the 'url' parameter (e.g., http://localhost:8080).
error flipt_client.exceptions.FliptClientError: Invalid authentication token ↓
cause The 'authentication_token' is missing or incorrect.
fix
Set FLIPT_AUTH_TOKEN environment variable or pass a valid token to the client.
Warnings
breaking The constructor argument 'auth_token' was renamed to 'authentication_token' in v1.3.0. ↓
fix Use 'authentication_token' instead of 'auth_token'.
gotcha If the Flipt server is unreachable, the client may raise a connection error; ensure the gRPC or HTTP port is correct. ↓
fix Verify the 'url' includes the correct port (e.g., http://localhost:8080 for REST, localhost:9000 for gRPC).
deprecated The synchronous client uses requests under the hood; consider switching to async for high-throughput scenarios. ↓
fix Use FliptEvaluationClientAsync for non-blocking calls.
Imports
- FliptEvaluationClient
from flipt_client import FliptEvaluationClient - FliptEvaluationClientAsync
from flipt_client import FliptEvaluationClientAsync
Quickstart
import os
from flipt_client import FliptEvaluationClient
client = FliptEvaluationClient(
namespace="default",
url="http://localhost:8080",
authentication_token=os.environ.get('FLIPT_AUTH_TOKEN', '')
)
flag_key = "my-flag"
entity_id = "user123"
context = {"plan": "enterprise"}
response = client.evaluate_variant(flag_key, entity_id, context)
print(response.match)
print(response.variant_key)