fixed recursive part for returning cursor() pages
modified: api.py
This commit is contained in:
parent
cf766311f0
commit
252ded6e00
1 changed files with 3 additions and 6 deletions
|
|
@ -388,7 +388,7 @@ class Twython(EndpointsMixin, object):
|
||||||
)
|
)
|
||||||
return self.cursor(self.search, q=search_query, **params)
|
return self.cursor(self.search, q=search_query, **params)
|
||||||
|
|
||||||
def cursor(self, function, **params, returnPages = False):
|
def cursor(self, function, returnPages = False, **params):
|
||||||
"""Returns a generator for results that match a specified query.
|
"""Returns a generator for results that match a specified query.
|
||||||
|
|
||||||
:param function: Instance of a Twython function (Twython.get_home_timeline, Twython.search)
|
:param function: Instance of a Twython function (Twython.get_home_timeline, Twython.search)
|
||||||
|
|
@ -441,11 +441,8 @@ class Twython(EndpointsMixin, object):
|
||||||
except (TypeError, ValueError): # pragma: no cover
|
except (TypeError, ValueError): # pragma: no cover
|
||||||
raise TwythonError('Unable to generate next page of search results, `page` is not a number.')
|
raise TwythonError('Unable to generate next page of search results, `page` is not a number.')
|
||||||
|
|
||||||
if returnPages:
|
for result in self.cursor(function, returnPages = returnPages, **params):
|
||||||
yield self.cursor(function, **params)
|
yield result
|
||||||
else:
|
|
||||||
for result in self.cursor(function, **params):
|
|
||||||
yield result
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def unicode2utf8(text):
|
def unicode2utf8(text):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue