tweepy
v4.7.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
  • StreamingClient
  • Exceptions
  • 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)
Previous Next

© Copyright 2009-2022, Joshua Roesslein. Revision 66205b1c.

Built with Sphinx using a theme provided by Read the Docs.
Read the Docs v: v4.7.0
Versions
latest
stable
v4.7.0
v4.6.0
v4.5.0
v4.4.0
v4.3.0
v4.2.0
v4.1.0
v4.0.1
v4.0.0
v3.10.0
v3.9.0
v3.8.0
v3.7.0
v3.6.0
v3.5.0
v3.4.0
v3.3.0
v3.2.0
v3.1.0
v3.0.0
v2.3.0
Downloads
On Read the Docs
Project Home
Builds