コード例 #1
0
ファイル: xmpp.py プロジェクト: xiaogaozi/buzzingcat
    def tl_command(self, message=None):
        """Handles /tl (timeline) requests."""
        email = self.has_service(message, 'Twitter')
        if email is None:
            return
        consumer_key, consumer_secret = datastore.get_oauth_consumer('t_')
        oauth_token, oauth_token_secret = datastore.get_oauth_token_and_secret(email, 'Twitter')
        t = twitter.TwitterAPI(consumer_key, consumer_secret,
                               oauth_token, oauth_token_secret)
        response = t.statuses_home_timeline()

        if response.status_code == 200:
            message.reply(response.content)
        else:
            message.reply(error.response_error(response, 'Twitter'))
コード例 #2
0
ファイル: xmpp.py プロジェクト: xiaogaozi/buzzingcat
    def t_command(self, message=None):
        """Handles /t (twitter) requests."""
        email = self.has_service(message, 'Twitter')
        if email is None:
            return
        consumer_key, consumer_secret = datastore.get_oauth_consumer('t_')
        oauth_token, oauth_token_secret = datastore.get_oauth_token_and_secret(email, 'Twitter')
        t = twitter.TwitterAPI(consumer_key, consumer_secret,
                               oauth_token, oauth_token_secret)
        response = t.statuses_update(message.arg)

        if response.status_code == 200:
            message.reply("Your tweet has sended.")
        else:
            message.reply(error.response_error(response, "Twitter"))