tweets.py 文件源码

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

项目:python-twitter-toolbox 作者: hhromic 项目源码 文件源码
def get_hydrated(writer, tweet_ids):
    """Get hydrated Tweet-objects from a list of Tweet ids."""
    LOGGER.info("get_hydrated() starting")

    # initialize config and Twitter API
    config = read_config()
    api = get_oauth_api(config)  # OAuth gives more capacity for the statuses/lookup API

    # process Tweet ids, storing returned Tweets in JSON format
    num_tweets = 0
    for chunk in gen_chunks(tweet_ids, size=LOOKUP_STATUSES_PER_REQUEST):
        try:
            num_tweets = write_objs(writer, api.statuses_lookup, {"id_": chunk[0]})
        except TweepError as err:
            log_tweep_error(LOGGER, err)
    LOGGER.info("downloaded %d Tweet(s)", num_tweets)

    # finished
    LOGGER.info("get_hydrated() finished")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号