flagboxsdk


Nameflagboxsdk JSON
Version 0.0.1 PyPI version JSON
download
home_pagehttps://flagbox.io
SummaryFlagBox SDK for Python
upload_time2025-07-18 19:18:53
maintainerNone
docs_urlNone
authorFlagBox
requires_python>=3.7
licenseNone
keywords flagbox sdk
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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

            

Raw data

            {
    "_id": null,
    "home_page": "https://flagbox.io",
    "name": "flagboxsdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "FlagBox, SDK",
    "author": "FlagBox",
    "author_email": "support@flagbox.io",
    "download_url": "https://files.pythonhosted.org/packages/c6/e0/bf312c3981a6b0f26535428b58a23ed34b78a2241318457d459b546adcec/flagboxsdk-0.0.1.tar.gz",
    "platform": null,
    "description": "# FlagBox Python SDK\n\nA 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.\n\n## Installation\n\n```bash\npip install flagboxsdk\n```\n\n## Quick Start\n\n```python\nfrom flagboxsdk import Client\n\n# Initialize the client\nclient = FlagBoxClient(\n    api_url=\"https://api.flagbox.io\",\n    api_key=\"your-api-key\"\n)\n\n# Get a feature flag value\nis_new_feature_enabled = client.get_flag(\"new-feature\", False)\n\nif is_new_feature_enabled:\n    # Feature is enabled\n    pass\nelse:\n    # Feature is disabled\n    pass\n```\n\n## Using Context\n\nThe SDK supports both global context (set during client initialization) and per-flag context:\n\n```python\n# Initialize client with global context\nclient = FlagBoxClient(\n    api_url=\"https://api.flagbox.io\",\n    api_key=\"your-api-key\",\n    global_context={\n        \"userId\": \"user123\",\n        \"plan\": \"premium\"\n    }\n)\n\n# Get flag with additional per-flag context\nresult = client.get_flag(\n    flag_key=\"new-feature\",\n    default_value=False,\n    context={\n        \"country\": \"Spain\"\n    }\n)\n```\n\n## Async Support\n\nFor asynchronous applications, use the async version of the client:\n\n```python\nimport asyncio\nfrom flagbox import FlagBoxClient\n\nasync def main():\n    client = FlagBoxClient(\n        api_url=\"https://api.flagbox.io\",\n        api_key=\"your-api-key\"\n    )\n\n    # Get a feature flag value asynchronously\n    is_new_feature_enabled = await client.get_flag_async(\n        \"new-feature\",\n        False\n    )\n\nasyncio.run(main())\n```\n\n## Error Handling\n\nThe SDK handles errors gracefully by returning the default value in case of:\n\n- Network errors\n- Invalid API responses\n- Unsupported flag types\n- Missing flags\n- Rate limit exceeded\n\n## Requirements\n\n- Python 3.7 or higher\n- requests>=2.25.0\n- aiohttp>=3.8.0\n\n## License\n\nMIT\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "FlagBox SDK for Python",
    "version": "0.0.1",
    "project_urls": {
        "Homepage": "https://flagbox.io"
    },
    "split_keywords": [
        "flagbox",
        " sdk"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c49194cb4be5875611bb4092a0d5d8edc6d78703b27ee06658019bd764f9dc4d",
                "md5": "520ef8e56a6abb9f09232d334a24a660",
                "sha256": "881b6b816f13c30bd047cb5aa8bec92f140743d9739dfabe6dcee2728a4949af"
            },
            "downloads": -1,
            "filename": "flagboxsdk-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "520ef8e56a6abb9f09232d334a24a660",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 4147,
            "upload_time": "2025-07-18T19:18:52",
            "upload_time_iso_8601": "2025-07-18T19:18:52.584192Z",
            "url": "https://files.pythonhosted.org/packages/c4/91/94cb4be5875611bb4092a0d5d8edc6d78703b27ee06658019bd764f9dc4d/flagboxsdk-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c6e0bf312c3981a6b0f26535428b58a23ed34b78a2241318457d459b546adcec",
                "md5": "f96bfaa4cdd980b62864f12907f97dcf",
                "sha256": "d34f02bb89010ebd7166f6772b0f64c30b394f8f26b291fe31ab0cebedec4cc1"
            },
            "downloads": -1,
            "filename": "flagboxsdk-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f96bfaa4cdd980b62864f12907f97dcf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 4025,
            "upload_time": "2025-07-18T19:18:53",
            "upload_time_iso_8601": "2025-07-18T19:18:53.860220Z",
            "url": "https://files.pythonhosted.org/packages/c6/e0/bf312c3981a6b0f26535428b58a23ed34b78a2241318457d459b546adcec/flagboxsdk-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-18 19:18:53",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "flagboxsdk"
}
        
Elapsed time: 0.85157s