from pathlib import Path import json import toml from .utils import Paths, PROGRAM_NAME class PublishMeetups: def __init__(self): self.config_file: Path = Path(Paths.CONFIG_PATH, "publish-meetups.toml") print(self.config_file) self.config = {} self.config = { "active_feeds": [ "mastodon", ], "mastodon": {}, } def __enter__(self): if self.config_file.exists(): with self.config_file.open("r") as f: self.config.update(toml.load(f)) print(self.config['active_feeds'][0]) return self def __exit__(self, exc_type, exc_val, exc_tb): with self.config_file.open("w") as f: toml.dump(self.config, f)