From b7031f6b11b9a30dfe4db13d67a1699e66a7b5bd Mon Sep 17 00:00:00 2001 From: Harmon Date: Thu, 28 Jan 2021 14:08:15 -0600 Subject: [PATCH] Remove monkey patching in IdIterator.next For models expecting API.parser to be ModelParser --- tweepy/cursor.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tweepy/cursor.py b/tweepy/cursor.py index 58df785..523e3f8 100644 --- a/tweepy/cursor.py +++ b/tweepy/cursor.py @@ -131,16 +131,10 @@ class IdIterator(BaseIterator): if self.index >= len(self.results) - 1: data = self.method(max_id=self.max_id, parser=RawParser(), *self.args, **self.kwargs) - if hasattr(self.method, '__self__'): - old_parser = self.method.__self__.parser - # Hack for models which expect ModelParser to be set - self.method.__self__.parser = ModelParser() - # This is a special invocation that returns the underlying # APIMethod class model = ModelParser().parse(self.method(create=True), data) if hasattr(self.method, '__self__'): - self.method.__self__.parser = old_parser result = self.method.__self__.parser.parse(self.method(create=True), data) else: result = model -- 2.25.1