From 4ba3bb166295d0c2b8c354dd3c6d10d8ca967f6a Mon Sep 17 00:00:00 2001 From: io Date: Mon, 26 Jul 2021 06:04:32 +0000 Subject: [PATCH] fetch_posts.py: use argparse --- fetch_posts.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fetch_posts.py b/fetch_posts.py index 158af02..95a0a4e 100755 --- a/fetch_posts.py +++ b/fetch_posts.py @@ -200,7 +200,9 @@ class PostFetcher: async def amain(): import json5 as json - with open('config.json' if len(sys.argv) < 2 else sys.argv[1]) as f: config = json.load(f) + import third_party.utils as utils + args = utils.arg_parser_factory(description='Fetch posts from all followed accounts').parse_args() + config = utils.load_config(args.cfg) async with PostFetcher(config=config) as fetcher: await fetcher.fetch_all() def main():