From: Daniel Chimeno Date: Fri, 8 Aug 2014 17:10:05 +0000 (+0200) Subject: Example of getting the model instance from factory X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2d9e582ca23763a8dcd789ca3847c12630cc1803;p=tweepy.git Example of getting the model instance from factory --- diff --git a/tweepy/models.py b/tweepy/models.py index cc169ba..f728b5f 100644 --- a/tweepy/models.py +++ b/tweepy/models.py @@ -248,8 +248,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 + for status in json['statuses']: - results.append(Status.parse(api, status)) + results.append(status_model.parse(api, status)) return results