twitter_helpers.py 文件源码

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

项目:cozmo-python-sdk 作者: anki 项目源码 文件源码
def post_tweet(twitter_api, tweet_text, reply_id=None, media_ids=None):
    '''post a tweet to the timeline, trims tweet if appropriate

    Args:
        twitter_api (:class:`tweepy.API`): the Twitter API instance to use
        tweet_text (string): the status text to tweet
        reply_id (int): optional, nests the tweet as reply to that tweet (use id_str element from a tweet)
        media_ids (list of media_ids): optional, media to attach to the tweet

    Returns:
        bool: True if posted successfully, False otherwise
    '''
    tweet_text = trim_tweet_text(tweet_text)
    try:
        twitter_api.update_status(tweet_text, reply_id, media_ids=media_ids)
        return True
    except tweepy.error.TweepError as e:
        cozmo.logger.error("post_tweet Error: " + str(e))
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号