learn_socket_twitter_bot.py 549 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
# learning socket programming

from twython import TwythonStreamer

c_k = "key"
c_s = "key"
a_t = "key"
a_s = "key"

count = 0

def increase():
    
    global count
    count = count+1

class MyStreamer(TwythonStreamer):
    
    def on_success(self, data):
        
        text = 'text'
        for text in data:
            increase()
            print (count)
            break
        
        if count == 3:
            print("Debian is popular!")
            
stream = MyStreamer(c_k, c_s, a_t, a_s)

stream.statuses.filter(track="#Debian")