当前位置: 首页>>代码示例>>Python>>正文


Python Twython.destroy_status方法代码示例

本文整理汇总了Python中twython.Twython.destroy_status方法的典型用法代码示例。如果您正苦于以下问题:Python Twython.destroy_status方法的具体用法?Python Twython.destroy_status怎么用?Python Twython.destroy_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twython.Twython的用法示例。


在下文中一共展示了Twython.destroy_status方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: generate_graphs

# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import destroy_status [as 别名]
def generate_graphs():
    for pair_config in KEYS:
        media_ids = []
        tweet = ''
        for interval in ['day', 'week', 'month', 'year']:
            text = output_graph(interval, pair_config)
            if not text:
                continue
            tweet += text
            if args.tweeting and pair_config['APP_KEY']:
                twitter = Twython(pair_config['APP_KEY'], pair_config['APP_SECRET'],
                                  pair_config['OAUTH_TOKEN'], pair_config['OAUTH_TOKEN_SECRET'])
                photo = open('{0}-{1}.png'.format(interval, pair_config['screen_name']), 'rb')
                try:
                    response = twitter.upload_media(media=photo)
                except TwythonError:
                    client.captureException()
                    return True
                media_ids += [response['media_id']]
            time.sleep(10)
        if args.tweeting and pair_config['APP_KEY']:
            twitter = Twython(pair_config['APP_KEY'], pair_config['APP_SECRET'],
                            pair_config['OAUTH_TOKEN'], pair_config['OAUTH_TOKEN_SECRET'])
            try:
                for status in twitter.get_user_timeline(screen_name=pair_config['screen_name']):
                    twitter.destroy_status(id=status['id_str'])
                twitter.update_status(status=tweet, media_ids=media_ids)
            except TwythonError:
                client.captureException()
开发者ID:PierreRochard,项目名称:coinbase-exchange-twitter,代码行数:31,代码来源:main.py

示例2: clean_tweet

# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import destroy_status [as 别名]
def clean_tweet(screen_name, clean_interval, clean_threshold,
                consumer_key, consumer_secret, access_key, access_secret):
    while True:
        try:
            twitter = Twython(consumer_key, consumer_secret, access_key, access_secret)
            my_statuses = twitter.get_user_timeline(screen_name=screen_name)
            # logging.debug(my_statuses)

            clean_base_datetime = (datetime.datetime.now()
                                   - datetime.timedelta(seconds=clean_threshold))

            for status in my_statuses:
                status_id = status['id']
                created_at = datetime.datetime.strptime(status['created_at'],
                                                        '%a %b %d %H:%M:%S +0000 %Y')
                text = status['text']
                # logging.debug("id:{} created_at:{} text:{}".format(status_id, created_at, text))

                should_destroy = (created_at < clean_base_datetime)
                if should_destroy:
                    logging.info("removing status:{} {} {}".format(status_id, created_at, text))
                    twitter.destroy_status(id=status_id)
                    # logging.info("removed status")
                    # raise Exception()

        except Exception as exception:
            logging.error("caught exception:{}".format(exception))

        logging.debug("sleeping {} seconds...".format(clean_interval))
        time.sleep(clean_interval)
开发者ID:honishi,项目名称:tweet-cleaner,代码行数:32,代码来源:clean.py

示例3: TwitterStreamer

# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import destroy_status [as 别名]
class TwitterStreamer(TwythonStreamer):
    def __init__(self, plugin, app_key, app_secret, oauth_token, oauth_token_secret):
        self.plugin = plugin
        self.app_key = app_key
        self.app_secret = app_secret
        self.oauth_token = oauth_token
        self.oauth_token_secret = oauth_token_secret
        TwythonStreamer.__init__(self, self.app_key, self.app_secret, self.oauth_token, self.oauth_token_secret)
        self.twitter_api = Twython(self.app_key, self.app_secret, self.oauth_token, self.oauth_token_secret)

    def on_success(self, data):
        if 'text' in data:
            item_data = data['text'].lower()
            self.plugin.update_items_with_data(item_data)
            self.twitter_api.destroy_status(id=data['id'])

    def on_error(self, status_code, data):
        print(status_code)
开发者ID:pfischi,项目名称:shTwitter,代码行数:20,代码来源:__init__.py

示例4: Twitter

# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import destroy_status [as 别名]
class Twitter(object):

    """ Class for twitter use """

    query_string = '#севастополь -украина OR северная OR катер OR SevastopolBoats OR sevboats :) since:%s lang:ru'
    weather_string = u'#погода в Севастополе на %s.'
    timelimit = 90
    max_follow = 100

    def __init__(self, auth=TWITTER_OAUTH_INFO):
        self.twitter = Twython(**auth)

    def post_tweet(self, message):
        """ Writes message into twitter stream """
        return self.twitter.update_status(status=message, trim_user=True)

    def delete_tweet(self, tweet_id):
        """ Remove tweet from timeline """
        return self.twitter.destroy_status(id=tweet_id, trim_user=True)

    def post_debug(self, message):
        """ Writes message into console to test """
        print message
        return dict(id=0, id_str='0', text=message)

    def search(self, query=None, count=10):
        """ Search tweet with sevboats ref """
        if query is None:
            since = (datetime.datetime.now() - datetime.timedelta(days=7)).date().strftime('%Y-%m-%d')
            query = self.query_string % since if 'since:%s' in self.query_string else self.query_string
        return self.twitter.search(q=query, count=count)

    def follow(self, user_id):
        """ Follow user by id """
        try:
            return self.twitter.create_friendship(user_id=user_id, follow=True)
        except TwythonError:
            return dict(status='error', id_str=None)

    def unfollow(self, user_id):
        """ Un Follow user by id """
        try:
            return self.twitter.destroy_friendship(user_id=user_id)
        except TwythonError:
            return dict(status='error', id_str=None)

    def follow_list(self, friends_ids):
        """ Follow user in search result """
        friends = []
        for user_id in friends_ids:
            friends.append(self.follow(user_id)['id_str'])
        return friends

    def unfollow_list(self, friends_ids):
        """ Un Follow user in ids list """
        friends = []
        for user_id in friends_ids:
            friends.append(self.unfollow(user_id)['id_str'])
        return friends

    def search_to_list(self, search_list=None):
        """ Follow user in search result """
        if search_list is None:
            search_list = self.search()
        users_ids = []
        for tweet in search_list['statuses']:
            users_ids.append(tweet['user']['id_str'])
        return users_ids

    def my_followers(self):
        """ Get list of my followers """
        followers_ids = []
        next_cursor = -1
        while next_cursor != '0':
            cursor = next_cursor
            fids = self.twitter.get_followers_ids(cursor=cursor, stringify_ids=True, count=1000)
            followers_ids += fids['ids']
            next_cursor = fids['next_cursor_str']
            time.sleep(self.timelimit)
        return followers_ids

    def follow_search(self):
        """ Follow for all user in search results """
        users_ids = self.search_to_list()
        self.follow_list(users_ids)
        return users_ids

    def follow_followers(self):
        """ Follow for all followers """
        followers_ids = self.my_followers()
        friends_ids = self.i_follow()
        users_ids = []
        for follower in followers_ids:
            if follower not in friends_ids:
                users_ids.append(follower)
        self.follow_list(users_ids[:self.max_follow])
        return users_ids

    def i_follow(self):
        """ Get list of user i follow what """
#.........这里部分代码省略.........
开发者ID:Samael500,项目名称:sev-boats,代码行数:103,代码来源:twitter.py

示例5: TwythonAPITestCase

# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import destroy_status [as 别名]
class TwythonAPITestCase(unittest.TestCase):
    def setUp(self):
        self.api = Twython(app_key, app_secret,
                           oauth_token, oauth_token_secret)

    # Timelines
    def test_get_mentions_timeline(self):
        '''Test returning mentions timeline for authenticated user succeeds'''
        self.api.get_mentions_timeline()

    def test_get_user_timeline(self):
        '''Test returning timeline for authenticated user and random user
        succeeds'''
        self.api.get_user_timeline()  # Authenticated User Timeline
        self.api.get_user_timeline(screen_name='twitter')  # Random User Timeline

    def test_get_protected_user_timeline_following(self):
        '''Test returning a protected user timeline who you are following
        succeeds'''
        self.api.get_user_timeline(screen_name=protected_twitter_1)

    def test_get_protected_user_timeline_not_following(self):
        '''Test returning a protected user timeline who you are not following
        fails and raise a TwythonAuthError'''
        self.assertRaises(TwythonAuthError, self.api.get_user_timeline,
                          screen_name=protected_twitter_2)

    def test_get_home_timeline(self):
        '''Test returning home timeline for authenticated user succeeds'''
        self.api.get_home_timeline()

    # Tweets
    def test_get_retweets(self):
        '''Test getting retweets of a specific tweet succeeds'''
        self.api.get_retweets(id=test_tweet_id)

    def test_show_status(self):
        '''Test returning a single status details succeeds'''
        self.api.show_status(id=test_tweet_id)

    def test_update_and_destroy_status(self):
        '''Test updating and deleting a status succeeds'''
        status = self.api.update_status(status='Test post just to get deleted :(')
        self.api.destroy_status(id=status['id_str'])

    def test_retweet(self):
        '''Test retweeting a status succeeds'''
        retweet = self.api.retweet(id='99530515043983360')
        self.api.destroy_status(id=retweet['id_str'])

    def test_retweet_twice(self):
        '''Test that trying to retweet a tweet twice raises a TwythonError'''
        retweet = self.api.retweet(id='99530515043983360')
        self.assertRaises(TwythonError, self.api.retweet,
                          id='99530515043983360')

        # Then clean up
        self.api.destroy_status(id=retweet['id_str'])

    def test_get_oembed_tweet(self):
        '''Test getting info to embed tweet on Third Party site succeeds'''
        self.api.get_oembed_tweet(id='99530515043983360')

    def test_get_retweeters_ids(self):
        '''Test getting ids for people who retweeted a tweet succeeds'''
        self.api.get_retweeters_ids(id='99530515043983360')

    # Search
    def test_search(self):
        '''Test searching tweets succeeds'''
        self.api.search(q='twitter')

    # Direct Messages
    def test_get_direct_messages(self):
        '''Test getting the authenticated users direct messages succeeds'''
        self.api.get_direct_messages()

    def test_get_sent_messages(self):
        '''Test getting the authenticated users direct messages they've
        sent succeeds'''
        self.api.get_sent_messages()

    def test_send_get_and_destroy_direct_message(self):
        '''Test sending, getting, then destory a direct message succeeds'''
        message = self.api.send_direct_message(screen_name=protected_twitter_1,
                                               text='Hey d00d!')

        self.api.get_direct_message(id=message['id_str'])
        self.api.destroy_direct_message(id=message['id_str'])

    def test_send_direct_message_to_non_follower(self):
        '''Test sending a direct message to someone who doesn't follow you
        fails'''
        self.assertRaises(TwythonError, self.api.send_direct_message,
                          screen_name=protected_twitter_2, text='Yo, man!')

    # Friends & Followers
    def test_get_user_ids_of_blocked_retweets(self):
        '''Test that collection of user_ids that the authenticated user does
        not want to receive retweets from succeeds'''
#.........这里部分代码省略.........
开发者ID:chrisbol,项目名称:twython,代码行数:103,代码来源:test_twython.py

示例6: Twython

# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import destroy_status [as 别名]
# Options and notes:
#
# Usage:  
#
##

from license import __author__
from license import __copyright__
from license import __copyrighta__
from license import __license__
__version__ = "0.0.1"
from license import __bitcoin__

import sys
from twython import Twython, TwythonError
from config import *

twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)

l = len(sys.argv)

if l >= 2:
    twid = sys.argv[1]
else:
    twid = input("ID number of tweet to delete: ")

try:
    tweet = twitter.destroy_status(id=twid)
except TwythonError as e:
    print(e)
开发者ID:Hasimir,项目名称:twython-tools,代码行数:32,代码来源:tweet-remove.py

示例7: __init__

# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import destroy_status [as 别名]
class TwitterBot:
    
    def __init__(self, name, con_k, con_s, acc_k, acc_s):
        self.name = name
        self.con_k = con_k
        self.con_s = con_s
        self.acc_k = acc_k
        self.acc_s = acc_s
        self.twitter = Twython(self.con_k, self.con_s, self.acc_k, self.acc_s)
        self.last_intervals = []
        # total number of trends you want to tweet
        self.num_trends = 3
        # number of seconds in a campaign window
        self.campaign_window = 600
        self.last_tweet = ""
        # tweets that will expire after a time limit
        self.temp_tweets = {}

    def tweet(self, msg):
        if self.twitter is not None:
            # > 140 char detection
            if len(msg) > 140:
                msg = msg[0:139]
            syslog.syslog('%s is tweeting %s' % (self.name, msg))
            try:
                tweet = self.twitter.update_status(status=msg)
                self.last_tweet = msg
                return tweet
            except Exception as e:
                syslog.syslog('%s error tweeting -> %s' % (self.name, str(e)))

    # Deletes a tweet from the given id
    def delete_tweet(self, tweet_id):
        if self.twitter is not None:
            try:
                destroyed = self.twitter.destroy_status(id=tweet_id)
                syslog.syslog('%s deleted %s' % (self.name, destroyed['text']))
                return destroyed
            except Exception as e:
                syslog.syslog('%s error deleting tweet -> %s' %(self.name, str(e)))

    # Deletes the most recent tweets
    def delete_tweets(self, num_tweets):
        if self.twitter is not None:
            try:
                timeline = self.twitter.get_user_timeline(screen_name = self.name, count = num_tweets)
                for tweet in timeline:
                    self.delete_tweet(tweet['id'])
                syslog.syslog('%s deleted %s tweet(s)' % (self.name, str(num_tweets)))
                return timeline
            except Exception as e:
                syslog.syslog('%s error deleting tweets -> %s' %(self.name, str(e)))


    # Replace all links in the text with the specified link
    def replace_link(self, text, link):
        replaced = ""
        for word in text.split():
            if word.startswith("http://") or word.startswith("https://"):
                replaced += link+" "
            else:
                replaced += word+" "
        replaced.strip()
        return replaced

    def retweet(self, tweet_id):
        if self.twitter is not None:
            try:
                tweet = self.twitter.retweet(id=tweet_id)
                syslog.syslog('%s is retweeting %s' % (self.name, tweet['text']))
                return tweet
            except Exception as e:
                syslog.syslog('%s error retweeting -> %s' %(self.name, str(e)))

    # This attack grabs a random tweet from a list of umich twitter accounts
    # If the tweet has a link it will be substituded for the attack link
    # The text of this modified tweet will then be tweeted by the bot
    # If the tweet does not have a link it is simply retweeted
    def repost_attack(self, link):
        if self.twitter is not None:
            try:
                #Get timeline of umich accounts
                umich_timeline = self.twitter.get_list_statuses(slug='UMich', owner_screen_name='JoseClark92', count=200)
                #Get user's timeline
                user_timeline = self.twitter.get_user_timeline(screen_name=self.name, count=100)
                #Get a random tweet that has not been posted by this bot
                repost = None
                while repost is None:
                    rand_tweet = random.choice(umich_timeline)
                    for tweet in user_timeline:
                        if rand_tweet['text'] in tweet: continue
                    repost = rand_tweet

                #If the tweet contains a link, replace the link and tweet it
                if "http" in repost['text']:
                    replaced = self.replace_link(repost['text'], link)
                    tweet = self.tweet(replaced)
                    #Add to the list of temporary tweets
                    self.temp_tweets[tweet['id']] = datetime.now()
                    return replaced
#.........这里部分代码省略.........
开发者ID:Dlarej,项目名称:security-privacy-botnet-project,代码行数:103,代码来源:birdie.py

示例8: TwitButler

# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import destroy_status [as 别名]
class TwitButler(object):
    
    def __init__(self, keys=consts.keys,me='exumbra_insoIem',logging=True):
        auth = [
            keys['app']['api_key'],
            keys['app']['api_secret'],
            keys['user']['access_token'],
            keys['user']['access_token_secret'],
        ]
        self.api = Twython(*auth)
        # self.api.update_status(status="tst3")
        
        self.streamer = TwythonStreamer(*auth)
        self.streamer.on_success = self.on_stream_success
        self.streamer.on_error = self.on_error
        self.me = me
        self.app_name = "twitbutler"
        self.logging = logging
    
    def on_stream_success(self,data):
        if (data.get('in_reply_to_screen_name') == self.me):
            try:
                log("____")
                log(data['text'])
                self.respond_to(data)
            except Exception as e:
                log(e)
                pass
    
    def respond_to(self,data):
        try:
            response = parse_command(data)
        except Exception as e:
            log(traceback.format_exc())
            self.debug_log_tweet(data,format(e.args))
            return
        if isinstance(response,str):
            # respond with string only!
            self.api.update_status(
                status = (
                    '@' + data['user']['screen_name'] +
                    " " + response
                ),
                in_reply_to_status_id = data['id']
            )
        elif isinstance(response, MediaResponse):
            self.api.update_status_with_media(
                status = (
                    '@' + data['user']['screen_name'] +
                    " " + response.text
                ),
                media = response.media,
                in_reply_to_status_id = data['id']
            )
        elif isinstance(response, DeleteResponse):
            # FIXME : here lies dirty work.
            reason = ""
            if 'in_reply_to_status_id' in data:
                orig_id = response.data['in_reply_to_status_id']
                try:
                    orig_tw = self.api.show_status(id=orig_id)
                except Exception as e:
                    ftext = "Can't get the original tweet : " + str(e)
                else:
                    if self.is_qualified_deletion_request(orig_tw, data):
                        try:
                            self.api.destroy_status(id=orig_tw['id'])
                            return
                        except Exception as e:
                            ftext = "Counldn't destroy it : " + str(e)
                    else:
                        ftext = "Can't delete that."
            else:
                ftext = "Specify tweet."
            self.api.update_status(
                status = (
                    '@' + data['user']['screen_name'] + ' ' + ftext
                    + ' [{}]'.format(str(time.time())[-6:])
                ),
                in_reply_to_status_id = data['id']
            )
    
    def on_error(self,status_code,data):
        log(status_code)
    
    def debug_log_tweet(self,data,txt):
        if self.logging:
            self.api.update_status(
                status = (
                    '@' + data['user']['screen_name'] +
                    " Exception: {} [{}]".format(txt, str(time.time())[:6])
                ),
                in_reply_to_status_id = data['id']
            )
        else:
            return
    
    def is_qualified_deletion_request(self,tw_del, tw_req):
        if self.app_name not in tw_del['source']:
            # if the tweet being requested for deletion
#.........这里部分代码省略.........
开发者ID:lesguillemets,项目名称:twitbutler,代码行数:103,代码来源:main.py

示例9: TwythonAPITestCase

# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import destroy_status [as 别名]

#.........这里部分代码省略.........
        succeeds"""
        self.api.get_user_timeline()  # Authenticated User Timeline
        self.api.get_user_timeline(screen_name='twitter')  # Random User Timeline

    def test_get_protected_user_timeline_following(self):
        """Test returning a protected user timeline who you are following
        succeeds"""
        self.api.get_user_timeline(screen_name=protected_twitter_1)

    def test_get_protected_user_timeline_not_following(self):
        """Test returning a protected user timeline who you are not following
        fails and raise a TwythonAuthError"""
        self.assertRaises(TwythonAuthError, self.api.get_user_timeline,
                          screen_name=protected_twitter_2)

    def test_retweeted_of_me(self):
        """Test that getting recent tweets by authenticated user that have
        been retweeted by others succeeds"""
        self.api.retweeted_of_me()

    def test_get_home_timeline(self):
        """Test returning home timeline for authenticated user succeeds"""
        self.api.get_home_timeline()

    # Tweets
    def test_get_retweets(self):
        """Test getting retweets of a specific tweet succeeds"""
        self.api.get_retweets(id=test_tweet_id)

    def test_show_status(self):
        """Test returning a single status details succeeds"""
        self.api.show_status(id=test_tweet_id)

    def test_update_and_destroy_status(self):
        """Test updating and deleting a status succeeds"""
        status = self.api.update_status(status='Test post just to get deleted :(')
        self.api.destroy_status(id=status['id_str'])

    def test_get_oembed_tweet(self):
        """Test getting info to embed tweet on Third Party site succeeds"""
        self.api.get_oembed_tweet(id='99530515043983360')

    def test_get_retweeters_ids(self):
        """Test getting ids for people who retweeted a tweet succeeds"""
        self.api.get_retweeters_ids(id='99530515043983360')

    # Search
    def test_search(self):
        """Test searching tweets succeeds"""
        self.api.search(q='twitter')

    # Direct Messages
    def test_get_direct_messages(self):
        """Test getting the authenticated users direct messages succeeds"""
        self.api.get_direct_messages()

    def test_get_sent_messages(self):
        """Test getting the authenticated users direct messages they've
        sent succeeds"""
        self.api.get_sent_messages()

    def test_send_get_and_destroy_direct_message(self):
        """Test sending, getting, then destory a direct message succeeds"""
        message = self.api.send_direct_message(screen_name=protected_twitter_1,
                                               text='Hey d00d! %s' % int(time.time()))
开发者ID:hungtrv,项目名称:twython,代码行数:69,代码来源:test_core.py

示例10:

# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import destroy_status [as 别名]
    print "usernames found:"
    print re.findall(regex, tweet)

  m = re.sub(regex, '', tweet)

  if debug:
    print "trimmed tweet:" + m

  # find any lowercase characters
  m = re.search('[a-z]', m)
  # if none are found
  if m is None:
    # ALL CAPS - DELETE
    print tweet
    print "ALL CAPS - DELETING: " + tweet_id
    try:
      twitter.destroy_status(id=tweet_id)
    except Exception, exception:
      print "Error:"
      print exception

  else:
    if debug:
      print "you're good"
    # sys.exit()

  if debug:
    print 'Sleeping... \n'

  time.sleep(timeout)
  # sys.exit()
开发者ID:meetar,项目名称:chillpill,代码行数:33,代码来源:chillpill.py

示例11: TwythonEndpointsTestCase

# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import destroy_status [as 别名]
class TwythonEndpointsTestCase(unittest.TestCase):
    def setUp(self):

        client_args = {
            'headers': {
                'User-Agent': '__twython__ Test'
            },
            'allow_redirects': False
        }

        # This is so we can hit coverage that Twython sets
        # User-Agent for us if none is supplied
        oauth2_client_args = {
            'headers': {}
        }

        self.api = Twython(app_key, app_secret,
                           oauth_token, oauth_token_secret,
                           client_args=client_args)

        self.oauth2_api = Twython(app_key, access_token=access_token,
                                  client_args=oauth2_client_args)

    # Timelines
    @unittest.skip('skipping non-updated test')
    def test_get_mentions_timeline(self):
        """Test returning mentions timeline for authenticated user succeeds"""
        self.api.get_mentions_timeline()

    @unittest.skip('skipping non-updated test')
    def test_get_user_timeline(self):
        """Test returning timeline for authenticated user and random user
        succeeds"""
        self.api.get_user_timeline()  # Authenticated User Timeline
        self.api.get_user_timeline(screen_name='twitter')
        # Random User Timeline

    @unittest.skip('skipping non-updated test')
    def test_get_protected_user_timeline_following(self):
        """Test returning a protected user timeline who you are following
        succeeds"""
        self.api.get_user_timeline(screen_name=protected_twitter_1)

    @unittest.skip('skipping non-updated test')
    def test_get_protected_user_timeline_not_following(self):
        """Test returning a protected user timeline who you are not following
        fails and raise a TwythonAuthError"""
        self.assertRaises(TwythonAuthError, self.api.get_user_timeline,
                          screen_name=protected_twitter_2)

    @unittest.skip('skipping non-updated test')
    def test_retweeted_of_me(self):
        """Test that getting recent tweets by authenticated user that have
        been retweeted by others succeeds"""
        self.api.retweeted_of_me()

    @unittest.skip('skipping non-updated test')
    def test_get_home_timeline(self):
        """Test returning home timeline for authenticated user succeeds"""
        self.api.get_home_timeline()

    # Tweets
    @unittest.skip('skipping non-updated test')
    def test_get_retweets(self):
        """Test getting retweets of a specific tweet succeeds"""
        self.api.get_retweets(id=test_tweet_id)

    @unittest.skip('skipping non-updated test')
    def test_show_status(self):
        """Test returning a single status details succeeds"""
        self.api.show_status(id=test_tweet_id)

    @unittest.skip('skipping non-updated test')
    def test_update_and_destroy_status(self):
        """Test updating and deleting a status succeeds"""
        status = self.api.update_status(status='Test post just to get \
                    deleted :( %s' % int(time.time()))
        self.api.destroy_status(id=status['id_str'])

    @unittest.skip('skipping non-updated test')
    def test_get_oembed_tweet(self):
        """Test getting info to embed tweet on Third Party site succeeds"""
        self.api.get_oembed_tweet(id='99530515043983360')

    @unittest.skip('skipping non-updated test')
    def test_get_retweeters_ids(self):
        """Test getting ids for people who retweeted a tweet succeeds"""
        self.api.get_retweeters_ids(id='99530515043983360')

    # Search
    @unittest.skip('skipping non-updated test')
    def test_search(self):
        """Test searching tweets succeeds"""
        self.api.search(q='twitter')

    # Direct Messages
    @unittest.skip('skipping non-updated test')
    def test_get_direct_messages(self):
        """Test getting the authenticated users direct messages succeeds"""
        self.api.get_direct_messages()
#.........这里部分代码省略.........
开发者ID:nouvak,项目名称:twython,代码行数:103,代码来源:test_endpoints.py


注:本文中的twython.Twython.destroy_status方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。