Skip to content

Python Configuration

from flags import new_client
client = new_client(
# Authentication (required)
project_id="your-project-id",
agent_id="your-agent-id",
environment_id="your-environment-id",
# API configuration
base_url="https://custom-api.flags.gg", # default: https://api.flags.gg
timeout=30, # default: 10 seconds
max_retries=5, # default: 3
# Cache
use_memory_cache=True, # default: False (uses SQLite)
sqlite_path="/path/to/cache.db", # default: /tmp/flags.db
# Custom user agent
user_agent="MyApp/1.0",
)
OptionDefaultDescription
project_idRequired. Project identifier
agent_idRequired. Agent identifier
environment_idRequired. Environment identifier
base_urlhttps://api.flags.ggCustom API endpoint
timeout10HTTP request timeout in seconds
max_retries3Max retry attempts
use_memory_cacheFalseUse in-memory cache instead of SQLite
sqlite_path/tmp/flags.dbPath to SQLite cache file
user_agentFlags-PythonCustom User-Agent header

All operations are thread-safe:

  • Memory cache uses read/write locks
  • SQLite cache uses connection pooling and transactions
  • Client operations are protected with appropriate locking

The SDK only requires the requests library.