No project description provided
Project description
heksher SDK for python
This is a library for using a heksher server from within python. Compatible with python 3.7, 3.8, and 3.9. The library contains both an asynchronous client, as well as a thread-based client. Also included are stub clients to make testing without a service simple.
Example usage
# main.py
from contextvars import ContextVar
from heksher import AsyncHeksherClient, Setting
user = ContextVar('user', default='guest')
class App:
...
async def startup(self):
...
# initialize the client, and set it as the process' main client
self.heksher_client = AsyncHeksherClient('http://heksher.service.url',
update_interval=60,
context_features=['user', 'trust', 'theme'])
# set certain context features to be retrieved either from string constants or
# context variables
self.heksher_client.set_defaults(user = user, theme="light")
await self.heksher_client.set_as_main()
async def shutdown(self):
await self.heksher_client.close()
...
cache_size_setting = Setting('cache_size', type=int, configurable_features=['user', 'trust'], default_value=10)
def foo(trust: str):
...
# should be run after App.startup is completed
cache_size = cache_size_setting.get(trust=trust)
...
Thread-based client usage is nearly identical.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
heksher-0.1.2.tar.gz
(14.4 kB
view details)
Built Distribution
heksher-0.1.2-py3-none-any.whl
(19.8 kB
view details)
File details
Details for the file heksher-0.1.2.tar.gz
.
File metadata
- Download URL: heksher-0.1.2.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.7 Linux/5.4.0-1039-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 709d0b5b082c5ae5a6249fd879075a57ffc0f47563db82891a616bf35e874e45 |
|
MD5 | 2453d1bb58cb35798ad2142d196ca280 |
|
BLAKE2b-256 | 7f8b87915cb13af568ff68ead9f72c3bccf213bbc456f075df498dcea8a44fbe |
File details
Details for the file heksher-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: heksher-0.1.2-py3-none-any.whl
- Upload date:
- Size: 19.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.7 Linux/5.4.0-1039-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 707db4c78dc7ddad76b2cccbaa21dbc5cacedfdffdae7f95ec045931a98db36f |
|
MD5 | d73ad49a704c72b710c1d5070ab3d0a1 |
|
BLAKE2b-256 | 5f59b29681c1091a3cc95ee7dc1432b024e718588e6d636ccb8acd9b0170c080 |