Name | stigg-sdk JSON |
Version |
0.687.2
JSON |
| download |
home_page | |
Summary | |
upload_time | 2023-11-30 00:13:07 |
maintainer | |
docs_url | None |
author | Stigg |
requires_python | >=3.9,<4.0 |
license | |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# stigg-sdk
Stigg Python SDK makes it easier to interact with Stigg Sidecar
## Installation
pip install stigg-sdk
## Usage
Initialize the client:
```python
import os
from stigg_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_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_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": "",
"name": "stigg-sdk",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Stigg",
"author_email": "support@stigg.io",
"download_url": "https://files.pythonhosted.org/packages/c1/7d/ac75ac06f79389d7eb5598fd0e04b68df0144fc1fa9a30678574c3c6214b/stigg_sdk-0.687.2.tar.gz",
"platform": null,
"description": "# stigg-sdk \n\nStigg Python SDK makes it easier to interact with Stigg Sidecar\n\n## Installation\n\n pip install stigg-sdk\n\n## Usage\n\nInitialize the client:\n\n```python\n\nimport os\nfrom stigg_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_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_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": "",
"summary": "",
"version": "0.687.2",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bb56979eac36dc5c9659dfccc9bee5373d11d782102042e6319a9d06da331a95",
"md5": "3ff300c5092e0e0f1ec005118e6e5690",
"sha256": "1a345f0794f03c269ba5ff5e238412c857bab8412f8b7c25d94ecc93eaa25cb4"
},
"downloads": -1,
"filename": "stigg_sdk-0.687.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3ff300c5092e0e0f1ec005118e6e5690",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 6422,
"upload_time": "2023-11-30T00:13:06",
"upload_time_iso_8601": "2023-11-30T00:13:06.080122Z",
"url": "https://files.pythonhosted.org/packages/bb/56/979eac36dc5c9659dfccc9bee5373d11d782102042e6319a9d06da331a95/stigg_sdk-0.687.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c17dac75ac06f79389d7eb5598fd0e04b68df0144fc1fa9a30678574c3c6214b",
"md5": "0b79b70f67de95b7b0102dcfb7929ba4",
"sha256": "93d7d4827dc89f55801e6fcbe68456b3d8ee22e64a3c91e25d17fea97a4e15e2"
},
"downloads": -1,
"filename": "stigg_sdk-0.687.2.tar.gz",
"has_sig": false,
"md5_digest": "0b79b70f67de95b7b0102dcfb7929ba4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 5779,
"upload_time": "2023-11-30T00:13:07",
"upload_time_iso_8601": "2023-11-30T00:13:07.666761Z",
"url": "https://files.pythonhosted.org/packages/c1/7d/ac75ac06f79389d7eb5598fd0e04b68df0144fc1fa9a30678574c3c6214b/stigg_sdk-0.687.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-30 00:13:07",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "stigg-sdk"
}