Ex: Cursor(api.friends_ids, cursor=123456)
The cursor will start iterating at position 12456 rather
than the first "page" (position -1).
Based on original work by Ruxandra Burtica in Pull request #194.
pages = list(Cursor(self.api.followers_ids, 'twitter').pages(1))
self.assert_(len(pages) == 1)
+ def testcursorsetstartcursor(self):
+ c = Cursor(self.api.friends_ids, cursor=123456)
+ self.assertEqual(c.iterator.next_cursor, 123456)
+ self.assertFalse('cursor' in c.iterator.kargs)
+
def __init__(self, method, args, kargs):
BaseIterator.__init__(self, method, args, kargs)
- self.next_cursor = -1
- self.prev_cursor = 0
+ start_cursor = kargs.pop('cursor', None)
+ self.next_cursor = start_cursor or -1
+ self.prev_cursor = start_cursor or 0
self.count = 0
def next(self):