diff options
author | Melody Horn <melody@boringcactus.com> | 2021-02-27 17:14:38 -0700 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-02-27 17:14:38 -0700 |
commit | 1cf5e68c25c0505194f23d4018e29767d3b519dd (patch) | |
tree | 63ec483c12e57ccbdea5e94ab82448cbff7b8753 /ctec/config.py | |
parent | bcb2b78eed508834192557e93f158f171f51f02d (diff) | |
download | ctec-1cf5e68c25c0505194f23d4018e29767d3b519dd.tar.gz ctec-1cf5e68c25c0505194f23d4018e29767d3b519dd.zip |
fetch inboxes
Diffstat (limited to 'ctec/config.py')
-rw-r--r-- | ctec/config.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ctec/config.py b/ctec/config.py new file mode 100644 index 0000000..471a5c2 --- /dev/null +++ b/ctec/config.py @@ -0,0 +1,18 @@ +import configparser +import pathlib + +from . import import_or_install + +def get_config(): + appdirs = import_or_install('appdirs') + config_dir = pathlib.Path(appdirs.user_config_dir(appname='ctec', appauthor=False)) + config_file = config_dir / 'ctec.ini' + print(config_file) + config = configparser.ConfigParser() + config.read(config_file) + if len(config.sections()) == 0: + config['global'] = {'awesomeness': '69'} + config_dir.mkdir(parents=True, exist_ok=True) + with open(config_file, 'w') as config_file: + config.write(config_file) + return config |