diff --git a/lib/spaceapi.py b/lib/spaceapi.py index 6818d54..6ee73ae 100644 --- a/lib/spaceapi.py +++ b/lib/spaceapi.py @@ -11,10 +11,15 @@ def spaceapi(bot, target=None): with aiohttp.Timeout(10): with aiohttp.ClientSession(loop=bot.loop) as session: - resp = yield from session.get(config['url']) - if resp.status != 200: - if target is not None: - bot.privmsg(target, "Error while retrieving spaceapi data") - raise Exception() - r = yield from resp.read() - return json.loads(r.decode('utf-8')) + ret = [] + for space_url in config['url'].split(): + msg = "Error while retrieving spaceapi data" + space_url + resp = yield from session.get(space_url) + if resp.status != 200: + if target is not None: + bot.privmsg(target, msg) + raise Exception() + r = yield from resp.read() + ret.append(json.loads(r.decode('utf-8'))) + + return ret diff --git a/plugins/cccongress.py b/plugins/cccongress.py index 8e2c0c6..c128bd7 100644 --- a/plugins/cccongress.py +++ b/plugins/cccongress.py @@ -202,8 +202,8 @@ def _get_talk(bot, hall, slot=0): try: json_data = _get_json_data(bot) - except: - """Silently ignore errors""" + except Exception as e: + bot.log.error(e) return [] now = datetime.datetime.now(pytz.timezone('Europe/Berlin')) diff --git a/plugins/status.py b/plugins/status.py index fe1ab9d..f7647d2 100644 --- a/plugins/status.py +++ b/plugins/status.py @@ -14,11 +14,13 @@ def status(bot, mask, target, args): try: data = yield from spaceapi(bot, target) - bot.privmsg(target, 'Space status:') - if data['state']['open']: - bot.privmsg(target, '\tThe space is open!') - else: - bot.privmsg(target, '\tThe space is closed!') + for space_data in data: + bot.privmsg(target, 'Space status of ' + space_data['space'] + ':') + if space_data['state']['open']: + bot.privmsg(target, '\tThe space is open!') + else: + bot.privmsg(target, '\tThe space is closed!') + except Exception as e: bot.log.error(e) bot.privmsg(target, '\tError while retrieving space status')