tweepy
v4.12.1
  • 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
  • Response
  • StreamingClient
  • StreamResponse
  • StreamRule
  • AsyncClient
  • AsyncStreamingClient
  • Wyjątki
  • Expansions and Fields
  • Models
  • Pagination

Meta

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

Pagination

class tweepy.Paginator(self, method, *args, limit=inf, pagination_token=None, **kwargs)

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

Informacja

When the returned response from the method being passed is of type requests.Response, it will be deserialized in order to parse the pagination tokens, likely negating any potential performance benefits from using a requests.Response return type.

Nowe w wersji 4.0.

Parametry
  • method – Client method to paginate for

  • args – Positional arguments to pass to method

  • limit – Maximum number of requests to make to the API

  • pagination_token – Pagination token to start pagination with

  • 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)
class tweepy.asynchronous.AsyncPaginator(self, method, *args, limit=inf, pagination_token=None, **kwargs)

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

Informacja

When the returned response from the method being passed is of type aiohttp.ClientResponse, it will be deserialized in order to parse the pagination tokens, likely negating any potential performance benefits from using a aiohttp.ClientResponse return type.

Nowe w wersji 4.11.

Parametry
  • method – AsyncClient method to paginate for

  • args – Positional arguments to pass to method

  • limit – Maximum number of requests to make to the API

  • pagination_token – Pagination token to start pagination with

  • kwargs – Keyword arguments to pass to method

flatten(limit=inf)

Flatten paginated data

Parametry

limit – Maximum number of results to yield

Poprzedni Następny

© Copyright 2009-2022, Joshua Roesslein. Revision cc8dd493.

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