Python tweepy.streaming() Examples

The following are 2 code examples of tweepy.streaming(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tweepy , or try the search function .
Example #1
Source File: oscrtwitter.py    From NoobSec-Toolkit with GNU General Public License v2.0 5 votes vote down vote up
def hist_tweet(t_api):
    con = ''
    try:
        while con != 'n' or con != 'N' or con != 'No' or con != 'no':
            try:
                num_tweets = input('How many tweets (200 maximum): ')
            except NameError:
                print "[+]ERROR: must be a number value!"
                return
            targetUsr = raw_input('Enter target user: ')
            user = t_api.get_user(targetUsr)
            print '\n'
            print 'Username: ', user.screen_name
            print 'Follower count: ', user.followers_count
            print '\n'
            target_tweets = t_api.user_timeline(targetUsr,count=num_tweets)
            counter = 0
            for tweet in target_tweets:
                counter += 1
                print counter, '-', tweet.text
            con = raw_input('Run again?(y/n): ')
            if con == 'no' or con == 'n' or con == 'N' or con == 'No':
                return
    except KeyboardInterrupt:
        return


# streaming class for the tweepy lib 
Example #2
Source File: oscrtwitter.py    From NoobSec-Toolkit with GNU General Public License v2.0 5 votes vote down vote up
def hist_tweet(t_api):
    con = ''
    try:
        while con != 'n' or con != 'N' or con != 'No' or con != 'no':
            try:
                num_tweets = input('How many tweets (200 maximum): ')
            except NameError:
                print "[+]ERROR: must be a number value!"
                return
            targetUsr = raw_input('Enter target user: ')
            user = t_api.get_user(targetUsr)
            print '\n'
            print 'Username: ', user.screen_name
            print 'Follower count: ', user.followers_count
            print '\n'
            target_tweets = t_api.user_timeline(targetUsr,count=num_tweets)
            counter = 0
            for tweet in target_tweets:
                counter += 1
                print counter, '-', tweet.text
            con = raw_input('Run again?(y/n): ')
            if con == 'no' or con == 'n' or con == 'N' or con == 'No':
                return
    except KeyboardInterrupt:
        return


# streaming class for the tweepy lib