twitter_streamer.py 文件源码

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

项目:emoji-prediction 作者: javierhonduco 项目源码 文件源码
def run_twitter_fetcher():
    sentry = Client(SENTRY_DSN)
    while True:
        try:
            l.info('starting streamer with {} emojis...'.format(len(EMOJIS)))
            sentry.captureMessage('starting `emoji-prediction`')
            streamer = TwitterEmojiStreamer(TwitterAuth.CONSUMER_KEY,
                                TwitterAuth.CONSUMER_SECRET,
                                TwitterAuth.ACCESS_TOKEN,
                                TwitterAuth.ACCESS_TOKEN_SECRET)
            streamer.statuses.filter(track=EMOJIS, language=LANGUAGE)
        # requests.exceptions.ConnectionError
        except ChunkedEncodingError:
            l.debug('chunked_encoding_error happened')
            pass
        except ConnectionError:
            l.debug('connection_error happened')
            pass
        except UnknownTwitterEmojiException as e:
            l.error('unknown exception ocurred')
            l.error(e)
            sentry.captureException()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号