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.
Metadata
Release files for tartarus-lib 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tartarus_lib-0.1.1.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tartarus_lib-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.2 kB
Release files / tartarus_lib-0.1.1.tar.gz
| Download URL | tartarus_lib-0.1.1.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
156c6c596c6c95156c2e949c7faf2cf05aeb69a554550791ea51bb4d0cbf9cf0
|
|
BLAKE2b-256 checksum How to use checksums |
fa48305df2a3417d8a7d211d74d978eb216f7034610955795512c7d6d6fdb54b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.0 CPython/3.12.8 Linux/6.5.0-1025-azure
|
Release files / tartarus_lib-0.1.1-py3-none-any.whl
| Download URL | tartarus_lib-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8601da332a38965a82353ce79350774573969d1aab946b62d118abe71b5519a2
|
|
BLAKE2b-256 checksum How to use checksums |
528f5663ed173ea1afedf5ca8838c5dca26e53e5afb798895a70e77734f44fa9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.0 CPython/3.12.8 Linux/6.5.0-1025-azure
|