diff --git a/twython/api.py b/twython/api.py index 6041ff6..1d23a35 100644 --- a/twython/api.py +++ b/twython/api.py @@ -390,7 +390,7 @@ class Twython(EndpointsMixin, object): ) return self.cursor(self.search, q=search_query, **params) - def cursor(self, function, **params): + def cursor(self, function, return_pages=False, **params): """Returns a generator for results that match a specified query. :param function: Instance of a Twython function (Twython.get_home_timeline, Twython.search) @@ -421,8 +421,11 @@ class Twython(EndpointsMixin, object): else: results = content - for result in results: - yield result + if return_pages: + yield results + else: + for result in results: + yield result if function.iter_mode == 'cursor' and content['next_cursor_str'] == '0': raise StopIteration