Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CursorIterator.prev: fix cursor unpacking #1067

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions tweepy/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,8 @@ def __init__(self, method, args, kargs):
def next(self):
if self.next_cursor == 0 or (self.limit and self.num_tweets == self.limit):
raise StopIteration
data, cursors = self.method(cursor=self.next_cursor,
*self.args,
**self.kargs)
self.prev_cursor, self.next_cursor = cursors
data, (self.prev_cursor, self.next_cursor) = self.method(
cursor=self.next_cursor, *self.args, **self.kargs)
if len(data) == 0:
raise StopIteration
self.num_tweets += 1
Expand All @@ -82,9 +80,8 @@ def next(self):
def prev(self):
if self.prev_cursor == 0:
raise TweepError('Can not page back more, at first page')
data, self.next_cursor, self.prev_cursor = self.method(cursor=self.prev_cursor,
*self.args,
**self.kargs)
data, (self.next_cursor, self.prev_cursor) = self.method(
cursor=self.prev_cursor, *self.args, **self.kargs)
self.num_tweets -= 1
return data

Expand Down