stigg-sidecar-sdk


Namestigg-sidecar-sdk JSON
Version 1.160.1 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2024-05-05 12:34:22
maintainerNone
docs_urlNone
authorStigg
requires_python<4.0,>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # stigg-sidecar-sdk 

Stigg Python SDK makes it easier to interact with Stigg Sidecar

## Documentation

See https://docs.stigg.io/docs/sidecar-sdk

## Installation

```shell
    pip install stigg-sidecar-sdk
```

## Usage

Initialize the client:

```python

import os
from stigg_sidecar_sdk import Stigg, ApiConfig, LocalSidecarConfig, RedisOptions

api_key = os.environ.get("STIGG_SERVER_API_KEY")

stigg = Stigg(
    ApiConfig(
        api_key=api_key,
    ),
    # for development purposes, configure local sidecar (spawned as a subprocess): 
    local_sidecar_config=LocalSidecarConfig(
        redis=RedisOptions(
            environment_prefix="development",
            host="localhost",
            port=6379,
            db=0
        )
    ),
    # for production use, set remote sidecar host and port:
    remote_sidecar_host='localhost',
    remote_sidecar_port=8443
)

```

Get single entitlement of a customer

```python

from stigg_sidecar_sdk import Stigg, ApiConfig, GetMeteredEntitlementRequest, MeteredEntitlementOptions


async def get_entitlement():
    stigg = Stigg(ApiConfig(api_key='api_key'))
    resp = await stigg.get_metered_entitlement(
        GetMeteredEntitlementRequest(customer_id='customer-demo-01',
                                     feature_id='feature-01-templates',
                                     options=MeteredEntitlementOptions(requested_usage=1))
    )
    print(resp.entitlement.has_access) 
```

Accessing the `api` client: 

```python

from stigg_sidecar_sdk import Stigg, ApiConfig
from stigg.generated import ProvisionCustomerInput

async def get_entitlement():
    stigg = Stigg(ApiConfig(api_key='api_key'))
    
    resp = await stigg.api.provision_customer(
        ProvisionCustomerInput(
            customer_id='customer-demo-01',
            name='customer-name'
        )
    )
    print("customer created", resp.provision_customer.customer.created_at)
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "stigg-sidecar-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Stigg",
    "author_email": "support@stigg.io",
    "download_url": "https://files.pythonhosted.org/packages/48/32/8a5b56ebff4a039a934b93e612819b9f4087728d8af9ae7aa3665ed44657/stigg_sidecar_sdk-1.160.1.tar.gz",
    "platform": null,
    "description": "# stigg-sidecar-sdk \n\nStigg Python SDK makes it easier to interact with Stigg Sidecar\n\n## Documentation\n\nSee https://docs.stigg.io/docs/sidecar-sdk\n\n## Installation\n\n```shell\n    pip install stigg-sidecar-sdk\n```\n\n## Usage\n\nInitialize the client:\n\n```python\n\nimport os\nfrom stigg_sidecar_sdk import Stigg, ApiConfig, LocalSidecarConfig, RedisOptions\n\napi_key = os.environ.get(\"STIGG_SERVER_API_KEY\")\n\nstigg = Stigg(\n    ApiConfig(\n        api_key=api_key,\n    ),\n    # for development purposes, configure local sidecar (spawned as a subprocess): \n    local_sidecar_config=LocalSidecarConfig(\n        redis=RedisOptions(\n            environment_prefix=\"development\",\n            host=\"localhost\",\n            port=6379,\n            db=0\n        )\n    ),\n    # for production use, set remote sidecar host and port:\n    remote_sidecar_host='localhost',\n    remote_sidecar_port=8443\n)\n\n```\n\nGet single entitlement of a customer\n\n```python\n\nfrom stigg_sidecar_sdk import Stigg, ApiConfig, GetMeteredEntitlementRequest, MeteredEntitlementOptions\n\n\nasync def get_entitlement():\n    stigg = Stigg(ApiConfig(api_key='api_key'))\n    resp = await stigg.get_metered_entitlement(\n        GetMeteredEntitlementRequest(customer_id='customer-demo-01',\n                                     feature_id='feature-01-templates',\n                                     options=MeteredEntitlementOptions(requested_usage=1))\n    )\n    print(resp.entitlement.has_access) \n```\n\nAccessing the `api` client: \n\n```python\n\nfrom stigg_sidecar_sdk import Stigg, ApiConfig\nfrom stigg.generated import ProvisionCustomerInput\n\nasync def get_entitlement():\n    stigg = Stigg(ApiConfig(api_key='api_key'))\n    \n    resp = await stigg.api.provision_customer(\n        ProvisionCustomerInput(\n            customer_id='customer-demo-01',\n            name='customer-name'\n        )\n    )\n    print(\"customer created\", resp.provision_customer.customer.created_at)\n```\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": null,
    "version": "1.160.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "221c86882d2be5f4f9760702e31829c4d54aec3dddf03ca7e90abbdb0137bc7b",
                "md5": "97c13802720f115d9334fe32c7d9175e",
                "sha256": "e267cb96e5e6b0b59e460e37b8e633d3ed53d2a0e8cff0ec265008caf63077d6"
            },
            "downloads": -1,
            "filename": "stigg_sidecar_sdk-1.160.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "97c13802720f115d9334fe32c7d9175e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 11829,
            "upload_time": "2024-05-05T12:34:19",
            "upload_time_iso_8601": "2024-05-05T12:34:19.632821Z",
            "url": "https://files.pythonhosted.org/packages/22/1c/86882d2be5f4f9760702e31829c4d54aec3dddf03ca7e90abbdb0137bc7b/stigg_sidecar_sdk-1.160.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "48328a5b56ebff4a039a934b93e612819b9f4087728d8af9ae7aa3665ed44657",
                "md5": "f51db0891efec10a083c9375cbed9c1b",
                "sha256": "68d6b9b67067cc4cf83242d345df5d8c4e35835d38f29812a51c9f6b8f9053a3"
            },
            "downloads": -1,
            "filename": "stigg_sidecar_sdk-1.160.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f51db0891efec10a083c9375cbed9c1b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 11000,
            "upload_time": "2024-05-05T12:34:22",
            "upload_time_iso_8601": "2024-05-05T12:34:22.748252Z",
            "url": "https://files.pythonhosted.org/packages/48/32/8a5b56ebff4a039a934b93e612819b9f4087728d8af9ae7aa3665ed44657/stigg_sidecar_sdk-1.160.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-05 12:34:22",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "stigg-sidecar-sdk"
}
        
Elapsed time: 0.27755s