TwitterAPI.TwitterPager¶
- class TwitterAPI.TwitterPager.TwitterPager(api, resource, params=None, hydrate_type=HydrateType.NONE)[source]¶
Continuous (stream-like) pagination of response from Twitter REST API resource. In addition to Public API endpoints, supports Premium Search API.
- Parameters
api – An authenticated TwitterAPI object
resource – String with the resource path (ex. search/tweets)
params – Dictionary of resource parameters
hydrate_type – HydrateType or int Do not hydrate - NONE or 0 (default) Append new field with ‘_hydrate’ suffix with hydrate values - APPEND or 1 Replace current field value with hydrate values - REPLACE or 2
- get_iterator(wait=5, new_tweets=False)[source]¶
Iterate response from Twitter REST API resource. Resource is called in a loop to retrieve consecutive pages of results.
- Parameters
wait – Floating point 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.