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


Python Twython.show_friendship方法代码示例

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


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

示例1: get_friendship

# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import show_friendship [as 别名]
    def get_friendship(token_id, url):
        soc_token = SocToken.query.get(token_id)
        twitter = Twython(
            SocConfig.TWITTER_KEY, SocConfig.TWITTER_SECRET, soc_token.user_token, soc_token.token_secret)
        reading_name = TwitterApi.parse_screen_name(url)
        friendship = twitter.show_friendship(
            source_screen_name=soc_token.soc_username, target_screen_name=reading_name)

        return friendship
开发者ID:bigbag,项目名称:archive_term-flask,代码行数:11,代码来源:twitter.py

示例2: check_relationship

# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import show_friendship [as 别名]
def check_relationship(log, id):
    my_screen_name = get_screen_name(log)
    if my_screen_name == "Unknown":
        raise("Couldn't get my own screen name")
    log.debug("      Checking relationship of %s with me (%s)", id, my_screen_name)
    check_twitter_config()
    logging.captureWarnings(True)
    old_level = log.getEffectiveLevel()
    log.setLevel(logging.ERROR)
    twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
    try:
        result = twitter.show_friendship(source_screen_name=my_screen_name, target_screen_name=id)
    except TwythonAuthError, e:
        log.setLevel(old_level)
        log.exception("   Problem trying to check relationship")
        twitter_auth_issue(e)
        raise
开发者ID:Ninotna,项目名称:evtools,代码行数:19,代码来源:tl_tweets.py

示例3: TwythonAPITestCase

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

#.........这里部分代码省略.........
        self.api.get_followers_ids()
        self.api.get_followers_ids(screen_name='twitter')

    def test_lookup_friendships(self):
        '''Test returning relationships of the authenticating user to the
        comma-separated list of up to 100 screen_names or user_ids provided
        succeeds'''
        self.api.lookup_friendships(screen_name='twitter,ryanmcgrath')

    def test_get_incoming_friendship_ids(self):
        '''Test returning incoming friendship ids succeeds'''
        self.api.get_incoming_friendship_ids()

    def test_get_outgoing_friendship_ids(self):
        '''Test returning outgoing friendship ids succeeds'''
        self.api.get_outgoing_friendship_ids()

    def test_create_friendship(self):
        '''Test creating a friendship succeeds'''
        self.api.create_friendship(screen_name='justinbieber')

    def test_destroy_friendship(self):
        '''Test destroying a friendship succeeds'''
        self.api.destroy_friendship(screen_name='justinbieber')

    def test_update_friendship(self):
        '''Test updating friendships succeeds'''
        self.api.update_friendship(screen_name=protected_twitter_1,
                                   retweets='true')

        self.api.update_friendship(screen_name=protected_twitter_1,
                                   retweets='false')

    def test_show_friendships(self):
        '''Test showing specific friendship succeeds'''
        self.api.show_friendship(target_screen_name=protected_twitter_1)

    def test_get_friends_list(self):
        '''Test getting list of users authenticated user then random user is
        following succeeds'''
        self.api.get_friends_list()
        self.api.get_friends_list(screen_name='twitter')

    def test_get_followers_list(self):
        '''Test getting list of users authenticated user then random user are
        followed by succeeds'''
        self.api.get_followers_list()
        self.api.get_followers_list(screen_name='twitter')

    # Users
    def test_get_account_settings(self):
        '''Test getting the authenticated user account settings succeeds'''
        self.api.get_account_settings()

    def test_verify_credentials(self):
        '''Test representation of the authenticated user call succeeds'''
        self.api.verify_credentials()

    def test_update_account_settings(self):
        '''Test updating a user account settings succeeds'''
        self.api.update_account_settings(lang='en')

    def test_update_delivery_service(self):
        '''Test updating delivery settings fails because we don't have
        a mobile number on the account'''
        self.assertRaises(TwythonError, self.api.update_delivery_service,
开发者ID:chrisbol,项目名称:twython,代码行数:70,代码来源:test_twython.py

示例4: isinstance

# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import show_friendship [as 别名]
    elif isinstance(target, int) is True:
        try:
            data = twitter.show_user(user_id=target)
        except TwythonError as e:
            print(e)
            data = ""
    elif isinstance(int(target), int) is True:
        try:
            data = twitter.show_user(user_id=target)
        except TwythonError as e:
            print(e)
            data = ""

    if len(data) >= 1:
        them = data["screen_name"]
        data1 = twitter.show_friendship(source_screen_name=me,
                                        target_screen_name=them)
        data2 = twitter.show_friendship(source_screen_name=them,
                                        target_screen_name=me)

        bdata = str(data).encode('utf-8')
        u = datetime.datetime.utcnow()
        dnow = u.isoformat()
        y = str(u.year)
        m0 = str(u.month)
        if len(m0) == 1:
            m = "0" + m0
        else:
            m = m0
        
        d0 = str(u.day)
        if len(d0) == 1:
开发者ID:Hasimir,项目名称:twython-tools,代码行数:34,代码来源:user-datamine.py

示例5: TwythonAPITestCase

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

#.........这里部分代码省略.........
        self.api.get_followers_ids()
        self.api.get_followers_ids(screen_name='twitter')

    def test_lookup_friendships(self):
        """Test returning relationships of the authenticating user to the
        comma-separated list of up to 100 screen_names or user_ids provided
        succeeds"""
        self.api.lookup_friendships(screen_name='twitter,ryanmcgrath')

    def test_get_incoming_friendship_ids(self):
        """Test returning incoming friendship ids succeeds"""
        self.api.get_incoming_friendship_ids()

    def test_get_outgoing_friendship_ids(self):
        """Test returning outgoing friendship ids succeeds"""
        self.api.get_outgoing_friendship_ids()

    def test_create_friendship(self):
        """Test creating a friendship succeeds"""
        self.api.create_friendship(screen_name='justinbieber')

    def test_destroy_friendship(self):
        """Test destroying a friendship succeeds"""
        self.api.destroy_friendship(screen_name='justinbieber')

    def test_update_friendship(self):
        """Test updating friendships succeeds"""
        self.api.update_friendship(screen_name=protected_twitter_1,
                                   retweets='true')

        self.api.update_friendship(screen_name=protected_twitter_1,
                                   retweets=False)

    def test_show_friendships(self):
        """Test showing specific friendship succeeds"""
        self.api.show_friendship(target_screen_name=protected_twitter_1)

    def test_get_friends_list(self):
        """Test getting list of users authenticated user then random user is
        following succeeds"""
        self.api.get_friends_list()
        self.api.get_friends_list(screen_name='twitter')

    def test_get_followers_list(self):
        """Test getting list of users authenticated user then random user are
        followed by succeeds"""
        self.api.get_followers_list()
        self.api.get_followers_list(screen_name='twitter')

    # Users
    def test_get_account_settings(self):
        """Test getting the authenticated user account settings succeeds"""
        self.api.get_account_settings()

    def test_verify_credentials(self):
        """Test representation of the authenticated user call succeeds"""
        self.api.verify_credentials()

    def test_update_account_settings(self):
        """Test updating a user account settings succeeds"""
        self.api.update_account_settings(lang='en')

    def test_update_delivery_service(self):
        """Test updating delivery settings fails because we don't have
        a mobile number on the account"""
        self.assertRaises(TwythonError, self.api.update_delivery_service,
开发者ID:hungtrv,项目名称:twython,代码行数:70,代码来源:test_core.py

示例6: TwythonEndpointsTestCase

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

#.........这里部分代码省略.........
        succeeds"""
        self.api.lookup_friendships(screen_name='twitter,ryanmcgrath')

    @unittest.skip('skipping non-updated test')
    def test_get_incoming_friendship_ids(self):
        """Test returning incoming friendship ids succeeds"""
        self.api.get_incoming_friendship_ids()

    @unittest.skip('skipping non-updated test')
    def test_get_outgoing_friendship_ids(self):
        """Test returning outgoing friendship ids succeeds"""
        self.api.get_outgoing_friendship_ids()

    @unittest.skip('skipping non-updated test')
    def test_create_friendship(self):
        """Test creating a friendship succeeds"""
        self.api.create_friendship(screen_name='justinbieber')

    @unittest.skip('skipping non-updated test')
    def test_destroy_friendship(self):
        """Test destroying a friendship succeeds"""
        self.api.destroy_friendship(screen_name='justinbieber')

    @unittest.skip('skipping non-updated test')
    def test_update_friendship(self):
        """Test updating friendships succeeds"""
        self.api.update_friendship(screen_name=protected_twitter_1,
                                   retweets='true')

        self.api.update_friendship(screen_name=protected_twitter_1,
                                   retweets=False)

    @unittest.skip('skipping non-updated test')
    def test_show_friendships(self):
        """Test showing specific friendship succeeds"""
        self.api.show_friendship(target_screen_name=protected_twitter_1)

    @unittest.skip('skipping non-updated test')
    def test_get_friends_list(self):
        """Test getting list of users authenticated user then random user is
        following succeeds"""
        self.api.get_friends_list()
        self.api.get_friends_list(screen_name='twitter')

    @unittest.skip('skipping non-updated test')
    def test_get_followers_list(self):
        """Test getting list of users authenticated user then random user are
        followed by succeeds"""
        self.api.get_followers_list()
        self.api.get_followers_list(screen_name='twitter')

    # Users
    @unittest.skip('skipping non-updated test')
    def test_get_account_settings(self):
        """Test getting the authenticated user account settings succeeds"""
        self.api.get_account_settings()

    @unittest.skip('skipping non-updated test')
    def test_verify_credentials(self):
        """Test representation of the authenticated user call succeeds"""
        self.api.verify_credentials()

    @unittest.skip('skipping non-updated test')
    def test_update_account_settings(self):
        """Test updating a user account settings succeeds"""
        self.api.update_account_settings(lang='en')
开发者ID:nouvak,项目名称:twython,代码行数:70,代码来源:test_endpoints.py

示例7: len

# 需要导入模块: from twython import Twython [as 别名]
# 或者: from twython.Twython import show_friendship [as 别名]
l = len(sys.argv)

if l == 1:
    user1 = input("Enter username or user ID of first user: ")
    user2 = input("Enter username or user ID of second user: ")
elif l == 2:
    user1 = sys.argv[1]
    user2 = input("Enter username or user ID of second user: ")
elif l >= 3:
    user1 = sys.argv[1]
    user2 = sys.argv[2]

if isinstance(user1, str) is True and isinstance(user2, str) is True:
    try:
        data1 = twitter.show_friendship(source_screen_name=user1, target_screen_name=user2)
        data2 = twitter.show_friendship(source_screen_name=user2, target_screen_name=user1)
    except TwythonError as e:
        print(e)
elif isinstance(user1, str) is True and isinstance(user2, int) is True:
    try:
        data1 = twitter.show_friendship(source_screen_name=user1, target_id=user2)
        data2 = twitter.show_friendship(source_id=user2, target_screen_name=user1)
    except TwythonError as e:
        print(e)
elif isinstance(user1, int) is True and isinstance(user2, str) is True:
    try:
        data1 = twitter.show_friendship(source_id=user1, target_screen_name=user2)
        data2 = twitter.show_friendship(source_screen_name=user2, target_id=user1)
    except TwythonError as e:
        print(e)
开发者ID:Hasimir,项目名称:twython-tools,代码行数:32,代码来源:view-relationship.py


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