From 71c031b64a397c54c8d5f64ead161df63ea1c99c Mon Sep 17 00:00:00 2001 From: Harmon Date: Thu, 28 Jan 2021 13:56:58 -0600 Subject: [PATCH] Default to Status model in SearchResults.parse more broadly for results To handle parsers without model_factory attribute or model factories without status attribute --- tweepy/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)) -- 2.25.1