3 Commits
0.2 ... 0.2.3

Author SHA1 Message Date
999987375c Encode login details in ASCII 2020-05-04 14:39:47 +01:00
4d624b1faf More output logging 2020-05-04 13:47:31 +01:00
da3727c672 Check for invalid login error message 2020-05-04 13:29:23 +01:00

View File

@@ -12,7 +12,7 @@ import requests
import argparse
LOG = logging.getLogger(__name__)
VERSION = 0.2
VERSION = '0.2.3'
AAISP_INFO_URL = 'https://chaos2.aa.net.uk/broadband/info'
@@ -55,10 +55,10 @@ def main():
sys.exit(1)
# attempt to get details from aaisp
LOG.info('Connecting to AAISP CHAOSv2 endpoint')
LOG.info('Connecting to AAISP CHAOSv2 endpoint as %s/%s', aaisp_username, '*' * len(aaisp_password))
response = requests.get(AAISP_INFO_URL, params={
'control_login': aaisp_username,
'control_password': aaisp_password
'control_login': aaisp_username.encode('ascii'),
'control_password': aaisp_password.encode('ascii')
})
if not response.status_code == requests.codes.ok:
LOG.error('Error connecting to AAISP CHAOSv2 endpoint: %s' % response.body)
@@ -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))