captcher configparser error

This commit is contained in:
Robert Kaussow 2018-06-09 22:46:31 +02:00
parent 53ecae953c
commit ddfa0a8a5a
1 changed files with 9 additions and 6 deletions

View File

@ -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)
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']
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