twitter.py 文件源码

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

项目:PlebNet 作者: rjwvandenberg 项目源码 文件源码
def tweet_arrival():
    options = UserOptions()
    options.read_settings()
    name = options.get('firstname') + ' ' + options.get('lastname')

    path = os.path.join(user_config_dir(), 'twitter.cfg')
    if not os.path.exists(path):
        print("Can't Tweet: {0} doesn't exist".format(path))
        return False
    cp = ConfigParser()
    cp.read(path)

    try:
        twitter = Twython(cp.get('twitter', 'app_key'),
                          cp.get('twitter', 'app_secret'),
                          cp.get('twitter', 'oauth_token'),
                          cp.get('twitter', 'oauth_token_secret'))
        twitter.update_status(
            status='Pleb %s has joined the botnet for good. #PlebNet #Cloudomate #Tribler #Bitcoin' % name)
        print("Tweeted arrival")
    except Exception, e:
        print e
        return False
    return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号