From 229471c70f36aac989fbe3f67558f7c2541a8793 Mon Sep 17 00:00:00 2001 From: Rafid Aslam Date: Fri, 13 Jan 2017 18:49:06 +0700 Subject: [PATCH] Change error handling in `get_subscribers()` in Zulip API client. Fixes #3281. --- zulip/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/zulip/__init__.py b/zulip/__init__.py index 209be5d..78e0011 100644 --- a/zulip/__init__.py +++ b/zulip/__init__.py @@ -659,11 +659,11 @@ class Client(object): ''' Example usage: client.get_subscribers(stream='devel') ''' - request_stream_id = self.get_stream_id(request['stream']) - try: - stream_id = request_stream_id['stream_id'] - except KeyError: - return request_stream_id + response = self.get_stream_id(request['stream']) + if response['result'] == 'error': + return response + + stream_id = response['stream_id'] url = 'streams/%d/members' % (stream_id,) return self.call_endpoint( url=url,