tweepy
v4.10.1
  • 설치하기
  • Tweepy 시작하기
  • 인증
  • Logging
  • 스트리밍

Twitter API v1.1 Reference

  • API
  • Stream
  • AsyncStream
  • 예외
  • 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.Cursor(method, *args, **kwargs)

Cursor can be used to paginate for any API methods that support pagination

매개변수
  • method – API method to paginate for

  • args – Positional arguments to pass to method

  • kwargs – Keyword arguments to pass to method

items(limit=inf)

Retrieve the items in each page/request

매개변수

limit – Maximum number of items to iterate over

반환값

Iterator to iterate through items

반환 형식

ItemIterator

pages(limit=inf)

Retrieve the page for each request

매개변수

limit – Maximum number of pages to iterate over

반환값

Iterator to iterate through pages

반환 형식

CursorIterator or DMCursorIterator or IdIterator or NextIterator or PageIterator

Example

import tweepy

auth = tweepy.OAuth2AppHandler("Consumer Key here", "Consumer Secret here")
api = tweepy.API(auth)

for status in tweepy.Cursor(api.search_tweets, "Tweepy",
                            count=100).items(250):
    print(status.id)

for page in tweepy.Cursor(api.get_followers, screen_name="TwitterDev",
                            count=200).pages(5):
    print(len(page))
Previous Next

© 저작권 2009-2022, Joshua Roesslein. Revision ad5e31be.

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