Metadata-Version: 2.4
Name: flagboxsdk
Version: 0.0.1
Summary: FlagBox SDK for Python
Home-page: https://flagbox.io
Author: FlagBox
Author-email: support@flagbox.io
Project-URL: Homepage, https://flagbox.io
Keywords: FlagBox,SDK
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.25.0
Requires-Dist: aiohttp>=3.8.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# FlagBox Python SDK

A lightweight Python SDK for managing feature flags with FlagBox. This SDK provides both synchronous and asynchronous methods for evaluating feature flags, with support for global and per-flag contexts.

## Installation

```bash
pip install flagboxsdk
```

## Quick Start

```python
from flagboxsdk import Client

# Initialize the client
client = FlagBoxClient(
    api_url="https://api.flagbox.io",
    api_key="your-api-key"
)

# Get a feature flag value
is_new_feature_enabled = client.get_flag("new-feature", False)

if is_new_feature_enabled:
    # Feature is enabled
    pass
else:
    # Feature is disabled
    pass
```

## Using Context

The SDK supports both global context (set during client initialization) and per-flag context:

```python
# Initialize client with global context
client = FlagBoxClient(
    api_url="https://api.flagbox.io",
    api_key="your-api-key",
    global_context={
        "userId": "user123",
        "plan": "premium"
    }
)

# Get flag with additional per-flag context
result = client.get_flag(
    flag_key="new-feature",
    default_value=False,
    context={
        "country": "Spain"
    }
)
```

## Async Support

For asynchronous applications, use the async version of the client:

```python
import asyncio
from flagbox import FlagBoxClient

async def main():
    client = FlagBoxClient(
        api_url="https://api.flagbox.io",
        api_key="your-api-key"
    )

    # Get a feature flag value asynchronously
    is_new_feature_enabled = await client.get_flag_async(
        "new-feature",
        False
    )

asyncio.run(main())
```

## Error Handling

The SDK handles errors gracefully by returning the default value in case of:

- Network errors
- Invalid API responses
- Unsupported flag types
- Missing flags
- Rate limit exceeded

## Requirements

- Python 3.7 or higher
- requests>=2.25.0
- aiohttp>=3.8.0

## License

MIT
