tweepy
v4.7.0
  • Instalacja
  • Pierwsze kroki
  • Authentication
  • Logging
  • Przesyłanie strumieniowe

Twitter API v1.1 Reference

  • API
  • Stream
  • AsyncStream
  • Wyjątki
  • Models
  • Pagination
  • Rozszerzone Tweety

Twitter API v2 Reference

  • Client
  • StreamingClient
  • Wyjątki
  • Models
  • Pagination

Meta

  • Changelog
  • Development
  • Examples
  • Frequently Asked Questions
tweepy
  • »
  • Pagination
  • Edytuj na GitHub

Pagination

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

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

Nowe w wersji 4.0.

Parametry
  • 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

Parametry

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)
Poprzedni Następny

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

Zbudowano w Sphinx używając theme dostarczone przez Read the Docs.