FastAPI Example Application¶
This example demonstrates how to use feature-flag-python in a FastAPI application.
Features Demonstrated¶
- Basic feature flags with
ais_enabled() - A/B testing with
aget_experiment()andaget_variant() - Decorators:
@afeature_flagand@aexperiment_variant - Error handling and graceful degradation
- Health checks with feature flag status
Running the Example¶
-
Install dependencies:
pip install -r requirements.txt -
Set up environment:
cp .env.example .env # Edit .env with your feature flag server URL -
Start the server:
python main.py