tweepy
v4.11.0
  • Installation
  • Getting started
  • Authentication
  • Logging
  • Streaming

Twitter API v1.1 Reference

  • API
  • Stream
  • AsyncStream
  • Exceptions
  • Models
  • Pagination
  • Extended Tweets

Twitter API v2 Reference

  • Client
  • Response
  • StreamingClient
  • StreamResponse
  • StreamRule
  • AsyncClient
  • AsyncStreamingClient
  • Exceptions
  • Expansions and Fields
  • Models
  • Pagination

Meta

  • Changelog
  • Development
  • Examples
  • Frequently Asked Questions
tweepy
  • »
  • Pagination
  • Edit on GitHub

Pagination

class tweepy.Paginator(method, *args, **kwargs)

Paginator can be used to paginate for any Client methods that support pagination

New in version 4.0.

Parameters
  • method – Client method to paginate for

  • args – Positional arguments to pass to method

  • kwargs – Keyword arguments to pass to method

flatten(limit=inf)

Flatten paginated data

Parameters

limit – Maximum number of results to yield

Example

import tweepy

client = tweepy.Client("Bearer Token here")

for response in tweepy.Paginator(client.get_users_followers, 2244994945,
                                    max_results=1000, limit=5):
    print(response.meta)

for tweet in tweepy.Paginator(client.search_recent_tweets, "Tweepy",
                                max_results=100).flatten(limit=250):
    print(tweet.id)
class tweepy.asynchronous.AsyncPaginator(method, *args, **kwargs)

AsyncPaginator can be used to paginate for any AsyncClient methods that support pagination

New in version 4.11.

Parameters
  • method – AsyncClient method to paginate for

  • args – Positional arguments to pass to method

  • kwargs – Keyword arguments to pass to method

flatten(limit=inf)

Flatten paginated data

Parameters

limit – Maximum number of results to yield

Previous Next

© Copyright 2009-2022, Joshua Roesslein. Revision 18a34f08.

Built with Sphinx using a theme provided by Read the Docs.