From: Harmon Date: Sat, 4 May 2019 04:19:27 +0000 (-0500) Subject: Handle map_ parameter for API.statuses_lookup X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9d7fc98aa1042890452d64999d49614b1f9afd15;p=tweepy.git Handle map_ parameter for API.statuses_lookup Fixes #598 --- 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))