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.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f473ac5fe44046fd55607a539c6c7141a8a9ffedac2146acb0ecb9bbc3094d9a |
|
MD5 | 3c50762b7d14426872429b0396415cd0 |
|
BLAKE2b-256 | 6bcc4cb6b007288e040c4bdf9c38f531b3e2859112c4f9922df9f0efad82e68f |