-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstream.py
More file actions
46 lines (25 loc) · 1017 Bytes
/
Copy pathstream.py
File metadata and controls
46 lines (25 loc) · 1017 Bytes
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import tweepy, json, re;
from tweepy import *;
from tweepy.streaming import StreamListener;
strCKey = "";
strCSecret = "";
strAToken = "";
strASecret = "";
class clsStreamListener( tweepy.StreamListener ) :
def on_status( self, status ) :
print( status.text );
def on_error( self, status ) :
print ( status.text );
try :
strInputTerm = input( "Please enter a search term, otherwise press enter: " )
if len( strInputTerm ) <= 0 :
strInputTerm = input( "Please enter a search term, otherwise press enter: " );
except :
print( "Unable to capture input - defaulting to'#awesomesauce'" )
strInputTerm = "#awesomesauce";
oAuth = OAuthHandler( strCKey, strCSecret );
oAuth.set_access_token( strAToken, strASecret );
oApi = tweepy.API( oAuth );
NewTweetListener = clsStreamListener();
TweetStream = tweepy.Stream( auth = oApi.auth, listener = NewTweetListener )
TweetStream.filter( track = [ strInputTerm ] );