Python client for devices interacting with configgery.com
Project description
Configgery Python client
Install
$ pip install configgery-client
Getting Started
This library allows you to fetch the latest set of configurations for your device.
First, create a device at configgery.com and store the generated private key and certificate in a safe place. Then, once you've added configurations to your device's group, you can fetch those same configurations.
Fetching configurations
from configgery.client import Client
client = Client('/path/to/configurations_dir', '/path/to/device.cert.pem', '/path/to/device.private.key')
client.download_configurations()
Checking if up-to-date
from configgery.client import Client
client = Client('/path/to/configurations_dir', '/path/to/device.cert.pem', '/path/to/device.private.key')
client.check_latest()
print(client.is_download_needed())
Using a configuration
from configgery.client import Client
client = Client('/path/to/configurations_dir', '/path/to/device.cert.pem', '/path/to/device.private.key')
success, data = client.get_configuration('myconfiguration.json')
if success:
print(data)
else:
print('Could not find configuration')
Updating state
from configgery.client import Client, DeviceState
client = Client('/path/to/configurations_dir', '/path/to/device.cert.pem', '/path/to/device.private.key')
client.download_configurations()
client.update_state(DeviceState.ConfigurationsApplied)
if device_happy(): # your own check
client.update_state(DeviceState.Upvote)
else:
client.update_state(DeviceState.Downvote)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for configgery_client-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7aa1c41d6ef3e89661805b878fe090fd25643da9f81dff0f55e726207d59ba7 |
|
MD5 | 2e71e380e6e6331f942bd7965abb6844 |
|
BLAKE2b-256 | 21aeb533808576d1a6411ec694bab82e0aa85dec76059d35b0bf5b09be2462db |