Skip to content

Python SDK

Pythonv0.1.4
Terminal window
pip install flags-gg
from flags import new_client
client = new_client(
project_id="your-project-id",
agent_id="your-agent-id",
environment_id="your-environment-id",
)
# Check a flag
if client.is_("new-feature").enabled():
print("Feature is enabled!")
# List all flags
for flag in client.list():
print(f"{flag.details.name}: {'enabled' if flag.enabled else 'disabled'}")
# API failures fall back to cached values automatically
result = client.is_("feature")
# Unknown flags return disabled
result = client.is_("non-existent")
assert not result.enabled()