Reforge Python SDK
raw JSON → 1.2.2 verified Fri May 01 auth: no python
Python SDK for Reforge Feature Flags and Config as a Service. Version 1.2.2 supports Python 3.9+ with incremental releases.
pip install sdk-reforge Common errors
error ModuleNotFoundError: No module named 'reforge' ↓
cause Installed sdk-reforge but tried to import 'reforge' incorrectly or missing dependencies.
fix
Ensure you have installed sdk-reforge (pip install sdk-reforge) and use 'from reforge import ReforgeClient'.
error reforge.exceptions.AuthenticationError: Invalid API key ↓
cause Provided API key is incorrect or missing.
fix
Verify your API key from the Reforge dashboard and pass it as api_key parameter.
error reforge.exceptions.EnvironmentNotFoundError: Environment '...' not found ↓
cause The environment name does not exist in your Reforge project.
fix
Check the environment name in your Reforge dashboard. Ensure it matches exactly (case-sensitive).
Warnings
breaking The library requires Python >=3.9 and <4. Python 3.8 and below are not supported. ↓
fix Upgrade to Python 3.9 or later.
gotcha The API key must be passed directly; environment variable loading is not automatic. ↓
fix Always pass the api_key explicitly or load via os.environ.
gotcha get_flag and get_config may raise exceptions if the environment or key is invalid. Ensure proper error handling. ↓
fix Wrap calls in try/except or check client.is_connected() first.
Imports
- ReforgeClient
from reforge import ReforgeClient - ConfigSource
from reforge import ConfigSource
Quickstart
from reforge import ReforgeClient
client = ReforgeClient(api_key=os.environ.get('REFORGE_API_KEY', ''),
environment='production')
# Get a feature flag
flag = client.get_flag('my-feature')
print(flag.is_enabled())
# Get a config value
config = client.get_config('my-config')
print(config.get_value())