twipper.batch

twipper.batch.search_tweets(access, query, page_count=1, filter_retweets=False, verified_account=False, language=None, result_type='mixed', count=100)

This function retrieves historical tweets on batch processing. These tweets contain the specified words on the query, which can use operators such as AND or OR, as specified on https://developer.twitter.com/en/docs/tweets/rules-and-filtering/overview/standard-operators. Additionally some extra arguments can be specified in order to particularize the tweet search, so on to retrieve the exact content the user is looking for. API Reference: https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets.html

Parameters:
  • access (twipper.credentials.Twipper) – object containing all the credentials needed to access api.twitter
  • query (str) – contains the query with the words to search along Twitter historic data.
  • page_count (int, optional) – specifies the amount of pages (100 tweets per page) to retrieve data from, default value is 1.
  • filter_retweets (boolean, optional) – can be either True or False, to filter out retweets or not, respectively, default value is False.
  • verified_account (boolean, optional) – can either be True or False to retrieve tweets just from verified accounts or from any account type, respectively.
  • language (str, optional) – is the language on which the tweet has been written, default value is None.
  • result_type (str, optional) – value to indicate which type of tweets want to be retrieved, it can either be mixed, popular or recent
  • count (int, optional) – number of tweets per requests to retrieve (default and max is 100).
Returns:

Returns a list containing all the retrieved tweets from Twitter API, based on the search query previously specified on the function arguments.

Return type:

list - tweets

Raises:

ValueError – raised if the introduced arguments do not match or errored.

twipper.batch.search_user_tweets(access, screen_name, page_count=1, filter_retweets=False, language=None, result_type='mixed', count=100)

This function retrieves historical tweets from a Twitter user by their screen_name (@), whenever they grant the application access their tweets for commercial purposes on ReadOnly permission. Retrieved tweets are stored on a list which will be returned to the user. API Reference: https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets.html

Parameters:
  • access (twipper.credentials.Twipper) – object containing all the credentials needed to access api.twitter
  • screen_name (str) – contains the username of the user from which tweets are going to be retrieved.
  • page_count (int, optional) – specifies the amount of pages (100 tweets per page) to retrieve data from, default value is 1.
  • filter_retweets (boolean, optional) – can be either True or False, to filter out retweets or not, respectively, default value is False.
  • language (str, optional) – is the language on which the tweet has been written, default value is None.
  • result_type (str, optional) – value to indicate which type of tweets want to be retrieved, it can either be mixed, popular or recent
  • count (int, optional) – number of tweets per requests to retrieve (default and max is 100).
Returns:

Returns a list containing all the retrieved tweets from Twitter, which means all the available tweets from the user specified on the arguments of the function.

Return type:

list - tweets

Raises:

ValueError – raised if the introduced arguments do not match or errored.