projects
/
tweepy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
191687f
)
Don't make an unnecessary API call in PageIterator
author
Aaron Hill
<aa1ronham@gmail.com>
Sun, 13 Apr 2014 19:45:38 +0000
(15:45 -0400)
committer
Aaron Hill
<aa1ronham@gmail.com>
Sun, 13 Apr 2014 19:45:38 +0000
(15:45 -0400)
tweepy/cursor.py
patch
|
blob
|
blame
|
history
diff --git
a/tweepy/cursor.py
b/tweepy/cursor.py
index ef81c524403c0f8c3028b2398312c3eda2dc2311..451e849c59f404277d6d7bb6c9e140b00a366b1b 100644
(file)
--- a/
tweepy/cursor.py
+++ b/
tweepy/cursor.py
@@
-133,10
+133,13
@@
class PageIterator(BaseIterator):
self.current_page = 0
def next(self):
- self.current_page += 1
+ if self.limit > 0 and self.current_page > self.limit:
+ raise StopIteration
+
items = self.method(page=self.current_page, *self.args, **self.kargs)
- if len(items) == 0
or (self.limit > 0 and self.current_page > self.limit)
:
+ if len(items) == 0:
raise StopIteration
+ self.current_page += 1
return items
def prev(self):