TwitterAPI 2.2 documentation

TwitterAPI.TwitterRestPager

«  TwitterAPI.TwitterAPI   ::   Contents   ::   TwitterAPI.TwitterOAuth  »

TwitterAPI.TwitterRestPager

class TwitterAPI.TwitterRestPager.TwitterRestPager(api, resource, params=None)

Continuous (stream-like) pagination of response from Twitter REST API resource.

Parameters:
  • api – An authenticated TwitterAPI object
  • resource – String with the resource path (ex. search/tweets)
  • params – Dictionary of resource parameters
get_iterator(wait=5, new_tweets=False)

Iterate response from Twitter REST API resource. Resource is called in a loop to retrieve consecutive pages of results.

Parameters:
  • wait – Integer number (default=5) of seconds wait between requests. Depending on the resource, appropriate values are 5 or 60 seconds.
  • new_tweets – Boolean determining the search direction. False (default) retrieves old results. True retrieves current results.
Returns:

JSON objects containing statuses, errors or other return info.

«  TwitterAPI.TwitterAPI   ::   Contents   ::   TwitterAPI.TwitterOAuth  »