press_sec_bot_plus.py 文件源码

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

项目:PressSecBotPlus 作者: robmathers 项目源码 文件源码
def convert_truncated(tweet):
    """Converts a tweet in extended compatibility mode to a fully extended tweet.
    These come from the Streaming API, and python-twitter will only extract a legacy style tweet.
    See https://dev.twitter.com/overview/api/upcoming-changes-to-tweets for details and https://github.com/twitterdev/tweet-updates/blob/master/samples/initial/compatibilityplus_extended_13997.json for an example.

    This hasn't been tested extensively, so may break in some cases, but seems to work so far."""
    raw_tweet = tweet._json
    if raw_tweet.has_key('extended_tweet'):
        for key, value in raw_tweet['extended_tweet'].items():
            raw_tweet[key] = value
    converted_tweet = Status.NewFromJsonDict(raw_tweet)
    return converted_tweet
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号