def send_tweet(message):
    try:
        api = twitter.Api(consumer_key, consumer_secret, token_key,
                          token_secret)
        api.PostUpdate(message)
        print "Tweet sended!"
    except:
        print "ERROR: Could not send tweet, make sure token_key & token_secret are correct."
Beispiel #2
0
def _send_notify(message):
    try:
        api = twitter.Api(CONSUMER_KEY, CONSUMER_SECRET, autosub.TWITTERKEY,
                          autosub.TWITTERSECRET)
        api.PostUpdate(message[:140])
        log.info("Twitter: Tweet sent")
        return True
    except:
        log.error("Twitter: Failed to send a tweet")
        return False
Beispiel #3
0
def _send_notify(message, twitterkey, twittersecret):
    if not twitterkey:
        twitterkey = autosub.TWITTERKEY

    if not twittersecret:
        twittersecret = autosub.TWITTERSECRET
    try:
        api = twitter.Api(CONSUMER_KEY, CONSUMER_SECRET, twitterkey,
                          twittersecret)
        api.PostUpdate(message[:140])
        log.info("Notification sent.")
        return True
    except:
        log.error("Notification failed.")
        return False