From 9d7fc98aa1042890452d64999d49614b1f9afd15 Mon Sep 17 00:00:00 2001 From: Harmon Date: Fri, 3 May 2019 23:19:27 -0500 Subject: [PATCH] Handle map_ parameter for API.statuses_lookup Fixes #598 --- docs/api.rst | 2 +- tweepy/models.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/api.rst b/docs/api.rst index df2bfe0..3148836 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -55,7 +55,7 @@ Timeline methods :param id_: A list of Tweet IDs to lookup, up to 100 :param include_entities: A boolean indicating whether or not to include `entities `_ in the returned tweets. Defaults to False. :param trim_user: A boolean indicating if user IDs should be provided, instead of full user information. Defaults to False. - :param map_: A boolean indicating whether or not to include tweets that cannot be shown, but with a value of None. Defaults to False. + :param map_: A boolean indicating whether or not to include tweets that cannot be shown. Defaults to False. :rtype: list of :class:`Status` objects diff --git a/tweepy/models.py b/tweepy/models.py index 21449d0..49a3600 100644 --- a/tweepy/models.py +++ b/tweepy/models.py @@ -60,6 +60,16 @@ class Model(object): a result set of model instances. """ results = ResultSet() + + # Handle map parameter for statuses/lookup + if isinstance(json_list, dict) and 'id' in json_list: + for _id, obj in json_list['id'].items(): + if obj: + results.append(cls.parse(api, obj)) + else: + results.append(cls.parse(api, {'id': int(_id)})) + return results + for obj in json_list: if obj: results.append(cls.parse(api, obj)) -- 2.25.1