diff options
-rw-r--r--[-rwxr-xr-x] | sjdbmk/grant.py (renamed from grant.py) | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/grant.py b/sjdbmk/grant.py index 08d1036..2bb761f 100755..100644 --- a/grant.py +++ b/sjdbmk/grant.py @@ -21,8 +21,13 @@ from __future__ import annotations from pprint import pprint from configparser import ConfigParser from typing import Any -import requests +import sys +import os + import msal # type: ignore +import requests + +from . import common # logging.basicConfig(level=logging.DEBUG) # logging.getLogger("msal").setLevel(logging.INFO) @@ -63,7 +68,9 @@ def test_login(app: msal.PublicClientApplication, config: ConfigParser) -> dict[ def main() -> None: config = ConfigParser() - config.read("config.ini") + if len(sys.argv) != 2 or not os.path.isfile(sys.argv[1]): + raise common.DailyBulletinError("You must specify a configuration file as the only argument") + config.read(sys.argv[1]) app = msal.PublicClientApplication( config["credentials"]["client_id"], authority=config["credentials"]["authority"], |