From 9ff31adbcd836e836d9e4aa429cb08b6be4edf1b Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Wed, 3 Nov 2021 15:59:31 -0400 Subject: [PATCH] [+] Parse config data class --- collect/utils.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/collect/utils.py b/collect/utils.py index 842f295..6b09425 100644 --- a/collect/utils.py +++ b/collect/utils.py @@ -33,16 +33,18 @@ def load_config() -> Config: """ Load config using JSON5, from either the local file ~/config.json5 or from the environment variable named config. - :return: Config dictionary object + :return: Config object """ if os.path.isfile('config.json5'): with open('config.json5', 'r') as f: - return json5.load(f) + conf = json5.load(f) else: - return json5.loads(os.getenv('config')) + conf = json5.loads(os.getenv('config')) + + return Config(**conf) -def tweepy_login(conf: dict) -> tweepy.API: +def tweepy_login(conf: Config) -> tweepy.API: """ Login to tweepy