telegram-sender/config.py

26 lines
552 B
Python
Raw Normal View History

2023-07-31 17:26:50 +03:00
from configparser import ConfigParser
from easydict import EasyDict as edict
CONFIG_FILE = 'config.ini'
data = ConfigParser()
data.read(CONFIG_FILE)
config = edict()
for section in data.sections():
config[section] = edict()
for key, value in data.items(section):
config[section][key] = value
def parse_bool(section=None, key=None, text=None):
if text is not None:
return text.lower() in ['yes', 'true']
if section is not None and key is not None:
return config[section][key].lower() in ['yes', 'true']