diff --git a/zulip/zulip/__init__.py b/zulip/zulip/__init__.py index 824bed2..7269865 100644 --- a/zulip/zulip/__init__.py +++ b/zulip/zulip/__init__.py @@ -580,8 +580,12 @@ class Client(object): # type: (Optional[str], str, Optional[Dict[str, Any]], bool, Optional[List[IO[Any]]]) -> Dict[str, Any] if request is None: request = dict() + marshalled_request = {} + for (k, v) in request.items(): + if v is not None: + marshalled_request[k] = v versioned_url = API_VERSTRING + (url if url is not None else "") - return self.do_api_query(request, versioned_url, method=method, + return self.do_api_query(marshalled_request, versioned_url, method=method, longpolling=longpolling, files=files) def call_on_each_event(self, callback, event_types=None, narrow=None): @@ -709,9 +713,6 @@ class Client(object): if narrow is None: narrow = [] - if event_types is None: - event_types = [] - request = dict( event_types=event_types, narrow=narrow, diff --git a/zulip/zulip/examples/recent-messages b/zulip/zulip/examples/recent-messages index 9525599..176ca49 100755 --- a/zulip/zulip/examples/recent-messages +++ b/zulip/zulip/examples/recent-messages @@ -43,7 +43,7 @@ options = parser.parse_args() client = zulip.init_from_options(options) request = { - 'narrow': [["stream", "Denmark"]], + 'narrow': [["pm-with", "rishig@zulipchat.com"]], 'num_before': options.count, 'num_after': 0, 'anchor': 1000000000,