def __init__(self):
loggit('TwitterSphereConfig...')
#consumer key, consumer secret, access token, access secret.
ckey="QpBbAaG5j5LQwtISpXHSnMaaZ"
csecret="siWbAxNBq9KojlwcoTnmZqo6yrUNsWAvVhZZ9DOY9nP2wRIUiw"
atoken="2728509485-FJjALLzmjoF4uBWMCWRz7gG2suUGSK9qYQiYI2a"
asecret="eJe1olMUVhK5gxz2RNZYNd4RT5H0zrJmINg2ot8w07Jaw"
api_url = 'http://192.169.141.201/iflychatbot/api/'
self.users = User.query.all()
self.sources = Source.query.all()
self.sources_count = len(self.sources)
self.sources_screen_names = [s.name.lower() for s in self.sources]
# Provide Twitter Dev tokens
auth = OAuthHandler(ckey, csecret)
auth.set_access_token(atoken, asecret)
# Use API to lookup id's for screen_names`
self.api = API(auth)
global twitterStream
twitterStream = Stream(auth, TwitterSphere())
global twitter_user_ids #keep this updated
global twitter_screen_names
twitter_user_ids = [s.id_str for s in self.sources if s.id_str != None]
twitter_screen_names = [s.name.lower() for s in self.sources if s.id_str != None]
global update_stream
update_stream = True #to trigger initial streaming, set false after stream starts
评论列表
文章目录