tstream.py 文件源码

python
阅读 44 收藏 0 点赞 0 评论 0

项目:sec_ai 作者: sboaseter 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号