Python client library for Tartarus Config Store
Project description
Tartarus-Lib: Python Client for Tartarus Config Store
Tartarus-Lib is a streamlined Python client designed for seamless interaction with the Tartarus Config Store API. It simplifies configuration management by providing intuitive methods for creating, retrieving, updating, and deleting configurations and their definitions.
Table of Contents
Installation
Install Tartarus-Lib using pip:
pip install tartarus-lib
Usage
This section provides an overview of the Tartarus-Lib client and its usage. This requires a basic understanding of the Tartarus Config Store API. For more information, refer to the Tartarus Config Store API Documentation.
Once the API Server is up and running, you can use the Tartarus-Lib client to interact with the API endpoints. The client provides sub-clients for each of the API endpoints, allowing you to perform CRUDL operations on configurations and their definitions.
Initialization
Import the TartarusAPIClient class and initialize it with the URL, API KEY of the Tartarus Config Store API:
from tartarus_lib.core import TartarusAPIClient
client = TartarusAPIClient(API_URL, API_KEY)
Sub-Clients
Tartarus-Lib provides sub-clients for each of the API endpoints. These sub-clients can be accessed using the client object:
config_definitions = client.config_definitions
configs = client.configs
Methods
Each sub-client provides methods for interacting with the corresponding API endpoint. The methods are designed to be intuitive and easy to use:
.create(): Create a new configuration or definition.retrieve(): Retrieve an existing configuration or definition.update(): Update an existing configuration or definition.delete(): Delete an existing configuration or definition.list(): List configurations or definitions (Paginated)
Example Usage
The following example demonstrates how to use the Tartarus-Lib client to interact with the Tartarus Config Store API:
Create a configuration definition. This step is necessary before creating a configuration. Please refer to the Tartarus Config Store API Documentation for more information on configuration definitions:
config_definitions.create(
config_definition_key="test_config_definition",
)
Create a configuration using the definition key and the configuration key. The data parameter contains the configuration values:
configs.create(
config_definition_key="test_config_definition",
config_key="test_config",
data={
"name": "Alice",
"age": 30
},
)
Retrieve the configuration using the definition key and the configuration key:
config = configs.retrieve(
config_definition_key="test_config_definition",
config_key="test_config"
)
Delete the configuration using the definition key and the configuration key:
configs.delete(
config_definition_key="test_config_definition",
config_key="test_config"
)
Error Handling
Tartarus-Lib raises TartarusError exceptions for any errors that occur during API requests. You can catch these exceptions and handle them accordingly:
from tartarus_lib.core import TartarusError
try:
'''
Perform API operations here
'''
except TartarusError as e:
'''
Handle the error here
'''
License
Tartarus-Lib is licensed under the Apache License 2.0. See LICENSE for more information.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tartarus_lib-0.1.1.tar.gz.
File metadata
- Download URL: tartarus_lib-0.1.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.0 CPython/3.12.8 Linux/6.5.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
156c6c596c6c95156c2e949c7faf2cf05aeb69a554550791ea51bb4d0cbf9cf0
|
|
| MD5 |
5948a7bf762836d612511b8fd5baca86
|
|
| BLAKE2b-256 |
fa48305df2a3417d8a7d211d74d978eb216f7034610955795512c7d6d6fdb54b
|
File details
Details for the file tartarus_lib-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tartarus_lib-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.0 CPython/3.12.8 Linux/6.5.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8601da332a38965a82353ce79350774573969d1aab946b62d118abe71b5519a2
|
|
| MD5 |
caa2a0675f4defeb5a64b764a0cb631f
|
|
| BLAKE2b-256 |
528f5663ed173ea1afedf5ca8838c5dca26e53e5afb798895a70e77734f44fa9
|