From ddfa0a8a5ae92ec8bd8ea1780618a820bc5c561b Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sat, 9 Jun 2018 22:46:31 +0200 Subject: [PATCH] captcher configparser error --- authenticator.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/authenticator.py b/authenticator.py index 802bba6..7ee40db 100644 --- a/authenticator.py +++ b/authenticator.py @@ -24,13 +24,16 @@ def api_auth(user, passwd, host): def main(): """Main logic entrypoint""" - config_path = os.path.join(os.path.expanduser("~"), "config.ini") - config = configparser.ConfigParser() - config.read(config_path) - - API_HOST = config['API']['HOST'] - API_USER = config['API']['USER'] - PASSWORD = config['API']['PASSWORD'] + try: + config_path = os.path.join(os.path.expanduser("~"), "config.ini") + config = configparser.ConfigParser() + config.read(config_path) + + API_HOST = config['API']['HOST'] + API_USER = config['API']['USER'] + PASSWORD = config['API']['PASSWORD'] + except configparser.Error: + return auth_token = api_auth(API_USER, PASSWORD, API_HOST) print auth_token