Fix IdIterator to pass API instance to parsers and models
authorHarmon <Harmon758@gmail.com>
Fri, 29 Oct 2021 16:22:28 +0000 (11:22 -0500)
committerHarmon <Harmon758@gmail.com>
Fri, 29 Oct 2021 16:22:28 +0000 (11:22 -0500)
tweepy/cursor.py

index e89b985e7df210fffbac878b56333e32e4e7608b..d3ccdd49a767b6ed6a9cada5d9e4ab4d58475496 100644 (file)
@@ -166,14 +166,14 @@ class IdIterator(BaseIterator):
         if self.index >= len(self.results) - 1:
             data = self.method(max_id=self.max_id, parser=RawParser(), *self.args, **self.kwargs)
 
-            # This is a special invocation that returns the underlying
-            # APIMethod class
             model = ModelParser().parse(
-                data, payload_list=self.method.payload_list,
+                data, api = self.method.__self__,
+                payload_list=self.method.payload_list,
                 payload_type=self.method.payload_type
             )
             result = self.method.__self__.parser.parse(
-                data, payload_list=self.method.payload_list,
+                data, api = self.method.__self__,
+                payload_list=self.method.payload_list,
                 payload_type=self.method.payload_type
             )