From: Harmon Date: Thu, 28 Jan 2021 19:56:58 +0000 (-0600) Subject: Default to Status model in SearchResults.parse more broadly for results X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=71c031b64a397c54c8d5f64ead161df63ea1c99c;p=tweepy.git Default to Status model in SearchResults.parse more broadly for results To handle parsers without model_factory attribute or model factories without status attribute --- diff --git a/tweepy/models.py b/tweepy/models.py index fc776d7..bad2682 100644 --- a/tweepy/models.py +++ b/tweepy/models.py @@ -280,7 +280,10 @@ class SearchResults(ResultSet): results.count = metadata.get('count') results.next_results = metadata.get('next_results') - status_model = getattr(api.parser.model_factory, 'status') if api else Status + try: + status_model = api.parser.model_factory.status + except AttributeError: + status_model = Status for status in json['statuses']: results.append(status_model.parse(api, status))