From da3727c672c8e099a04535eebfb041281ed7b204 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Mon, 4 May 2020 13:29:23 +0100 Subject: [PATCH] Check for invalid login error message --- aaisp-to-mqtt.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/aaisp-to-mqtt.py b/aaisp-to-mqtt.py index dbf4bdd..010b0e3 100755 --- a/aaisp-to-mqtt.py +++ b/aaisp-to-mqtt.py @@ -12,7 +12,7 @@ import requests import argparse LOG = logging.getLogger(__name__) -VERSION = 0.2 +VERSION = 0.2.1 AAISP_INFO_URL = 'https://chaos2.aa.net.uk/broadband/info' @@ -66,7 +66,10 @@ def main(): data = response.json() if 'info' not in data: - LOG.fatal('info section not found in AAISP CHAOSv2 response') + if 'error' in data: + LOG.fatal('Error encounted: %s' % data['error']) + else: + LOG.fatal('info section not found in AAISP CHAOSv2 response') sys.exit(1) circuits = data['info'] LOG.info('Got %s circuits', len(circuits))