twipper.streaming

twipper.streaming.stream_country_tweets(access, country, language=None, filter_retweets=False, tweet_limit=None, date_limit=None, retry=5)

This function retrieves streaming tweets matching the given query, so on, this function will open a stream to the Twitter Streaming API to retrieve real-time tweets. By the time these tweets are retrieved, they are handled and returned as a list. API Reference: https://developer.twitter.com/en/docs/tweets/filter-realtime/guides/basic-stream-parameters.html

Parameters:
  • access (twipper.credentials.Twipper) – object containing all the credentials needed to access api.twitter
  • country (str) – contains the country name from where generic tweets will be retrieved.
  • language (str, optional) – is the language on which the tweet has been written, default is None.
  • filter_retweets (boolean, optional) – can be either True or False, to filter out retweets or not, respectively.
  • tweet_limit (int, optional) – specifies the amount of tweets to be retrieved on streaming, default is 10k tweets.
  • date_limit (str, optional) – specifies the date (format yyyymmddhhmm) where the stream will stop, default is None
  • retry (int or str, optional) – value to set the number of retries if connection to api.twitter fails, it can either be an int or a str which can just be the value no_limit in the case that no retry limits want to be set. Default value is 5 retries whenever connection fails, until function finishes.
Returns:

Yields 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.

twipper.streaming.stream_tweets(access, query, language=None, filter_retweets=False, tweet_limit=None, date_limit=None, retry=5)

This function retrieves streaming tweets matching the given query, so on, this function will open a stream to the Twitter Streaming API to retrieve real-time tweets. By the time these tweets are retrieved, they are handled and returned as a list. API Reference: https://developer.twitter.com/en/docs/tweets/filter-realtime/guides/basic-stream-parameters.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 the Twitter Streaming.
  • language (str, optional) – is the language on which the tweet has been written, default is None.
  • filter_retweets (boolean, optional) – can be either True or False, to filter out retweets or not, respectively.
  • tweet_limit (int, optional) – specifies the amount of tweets to be retrieved on streaming, default is 10k tweets.
  • date_limit (str, optional) – specifies the date (format yyyymmddhhmm) where the stream will stop, default is None
  • retry (int or str, optional) – value to set the number of retries if connection to api.twitter fails, it can either be an int or a str which can just be the value no_limit in the case that no retry limits want to be set. Default value is 5 retries whenever connection fails, until function finishes.
Returns:

Yields 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.