forked from psychemedia/newt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
streamTest.py
33 lines (22 loc) · 810 Bytes
/
streamTest.py
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
import newt,tweepy,time
class StreamListener(tweepy.StreamListener):
def on_status(self, status):
try:
print status.text,str(self.count)
print '\n %s %s via %s\n' % (status.author.screen_name, status.created_at, status.source)
self.count=self.count-1
if self.count<0: streamer.disconnect()
except Exception, e:
# Catch any unicode errors while printing to console
# and just ignore them to avoid breaking application.
pass
api=newt.getTwitterAPI()
authl=newt.getTwitterAuth()
l = StreamListener()
streamer = tweepy.Stream(auth=authl, listener=l, timeout=300.0 )
setTerms = ['this','that']
print "gettong ready"
streamer.count=3
print streamer.count
print "sdsd"
streamer.filter(None,setTerms)