Zephyr: For correctness & mypy, res.get('result') -> res['result'].

Also correct nearby error message (subscribing to -> receiving).
This commit is contained in:
neiljp (Neil Pilgrim) 2018-01-08 06:49:02 -08:00 committed by showell
parent 02d9ba8edd
commit aa718da3e1

View file

@ -125,7 +125,7 @@ def send_zephyr(zwrite_args, content):
# Subscribe to Zulip # Subscribe to Zulip
try: try:
res = zulip_client.register(event_types=["message"]) res = zulip_client.register(event_types=["message"])
if 'error' in res.get('result'): if 'error' in res['result']:
logging.error("Error subscribing to Zulips!") logging.error("Error subscribing to Zulips!")
logging.error(res['msg']) logging.error(res['msg'])
print_status_and_exit(1) print_status_and_exit(1)
@ -263,8 +263,8 @@ logger.info("Starting receiving messages!")
# receive zulips # receive zulips
res = zulip_client.get_events(queue_id=queue_id, last_event_id=last_event_id) res = zulip_client.get_events(queue_id=queue_id, last_event_id=last_event_id)
if 'error' in res.get('result'): if 'error' in res['result']:
logging.error("Error subscribing to Zulips!") logging.error("Error receiving Zulips!")
logging.error(res['msg']) logging.error(res['msg'])
print_status_and_exit(1) print_status_and_exit(1)
messages = [event['message'] for event in res['events']] messages = [event['message'] for event in res['events']]