tweepy
v4.14.0
  • 설치하기
  • Getting Started
  • 인증
  • Logging

Twitter API v1.1 Reference

  • API
  • 예외
  • 확장 트윗
  • Models
  • Pagination

Twitter API v2 Reference

  • Client
  • Response
  • StreamingClient
  • StreamResponse
  • StreamRule
  • AsyncClient
  • AsyncStreamingClient
  • 예외
  • Expansions and Fields
  • Models
  • Pagination
  • 스트리밍

Meta

  • 체인지로그
  • 개발
  • 예시
  • 자주 묻는 질문(FAQ)
tweepy
  • »
  • Pagination
  • Edit on 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

참고

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.

버전 4.0에 추가.

매개변수
  • 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

매개변수

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

참고

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.

버전 4.11에 추가.

매개변수
  • 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

매개변수

limit – Maximum number of results to yield

Previous Next

© 저작권 2009-2023, Joshua Roesslein. Revision bb0f581f.

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