A package for handling configuration files
Project description
pyconfighandler
pyconfighandler is a Python package for handling configuration files. It provides a Config
class that allows you to easily create, read, update, and delete configuration files in different formats such as JSON and TOML.
Installation
You can install pyconfighandler using pip:
pip install pyconfighandler
Usage
Here's an example of how to use pyconfighandler:
from pyconfighandler import Config
# Create a new configuration file
config = Config('config', 'json')
# Add content to the configuration file
config.add_content({'key': 'value'})
# Get the contents of the configuration file
contents = config.get_content()
print(contents) # Output: {'key': 'value'}
# Update the contents of the configuration file
config.update_content({'key2': 'value2'})
# Get the updated contents
contents = config.get_content()
print(contents) # Output: {'key': 'value', 'key2': 'value2'}
# Destroy the configuration file
config.destroy_config()
In the example above, we create a Config instance with a file name of 'config' and a file type of 'json'. We then add content to the configuration file using the add_content method and retrieve the contents using the get_content method. We update the contents with new values using the update_content method and finally destroy the configuration file with the destroy_config method.
Supported File Types
pyconfighandler supports the following file types for configuration files:
- JSON (.json)
- TOML (.toml)
When creating a Config instance, make sure to provide the appropriate file type.
License
This project is licensed under the MIT License. See the LICENSE file for more information.
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
Hashes for configwizard-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bb59f06f540edd996bbdbaba936e4f72ddf5b607914e92c8073b415c6d7e616 |
|
MD5 | 68149bd973c5ad1c2f4bf2149f407c7b |
|
BLAKE2b-256 | c37c1437c49d4084d3d91ff287a7fd7a27c7397780f17693a9b54c83b0079b5d |