本文整理汇总了Python中tweepy.API.friends_ids方法的典型用法代码示例。如果您正苦于以下问题:Python API.friends_ids方法的具体用法?Python API.friends_ids怎么用?Python API.friends_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tweepy.API
的用法示例。
在下文中一共展示了API.friends_ids方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start
# 需要导入模块: from tweepy import API [as 别名]
# 或者: from tweepy.API import friends_ids [as 别名]
def start():
global redis_conn
redis_conn = redis.StrictRedis(host="localhost", port=6379, db=0)
consumer_key = config.get("twitter", "client_id")
consumer_secret = config.get("twitter", "client_secret")
access_token = config.get("twitter", "access_token")
access_token_secret = config.get("twitter", "access_token_secret")
l = StdOutListener()
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = API(auth)
friend_ids = api.friends_ids()
stream = Stream(auth, l)
# ,track=['startup','entrepreneurship','marketing','SEO']
stream.filter(follow=friend_ids, track=["clojure"]) # ,track=[
示例2: get_golfers
# 需要导入模块: from tweepy import API [as 别名]
# 或者: from tweepy.API import friends_ids [as 别名]
def get_golfers():
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = API(auth)
golfers = api.friends_ids(screen_name = "golfjobb")
return golfers
示例3: TweepyAPITests
# 需要导入模块: from tweepy import API [as 别名]
# 或者: from tweepy.API import friends_ids [as 别名]
#.........这里部分代码省略.........
self.api.sent_direct_messages()
def testsendanddestroydirectmessage(self):
# send
sent_dm = self.api.send_direct_message(username, text='test message')
self.assertEqual(sent_dm.text, 'test message')
self.assertEqual(sent_dm.sender.screen_name, username)
self.assertEqual(sent_dm.recipient.screen_name, username)
# destroy
destroyed_dm = self.api.destroy_direct_message(sent_dm.id)
self.assertEqual(destroyed_dm.text, sent_dm.text)
self.assertEqual(destroyed_dm.id, sent_dm.id)
self.assertEqual(destroyed_dm.sender.screen_name, username)
self.assertEqual(destroyed_dm.recipient.screen_name, username)
def testcreatedestroyfriendship(self):
enemy = self.api.destroy_friendship('twitter')
self.assertEqual(enemy.screen_name, 'twitter')
# Wait 5 seconds to allow Twitter time
# to process the friendship destroy request.
sleep(5)
friend = self.api.create_friendship('twitter')
self.assertEqual(friend.screen_name, 'twitter')
def testshowfriendship(self):
source, target = self.api.show_friendship(target_screen_name='twtiter')
self.assert_(isinstance(source, Friendship))
self.assert_(isinstance(target, Friendship))
def testfriendsids(self):
self.api.friends_ids(username)
def testfollowersids(self):
self.api.followers_ids(username)
def testverifycredentials(self):
self.assertNotEqual(self.api.verify_credentials(), False)
# make sure that `me.status.entities` is not an empty dict
me = self.api.verify_credentials(include_entities=True)
self.assertTrue(me.status.entities)
# `status` shouldn't be included
me = self.api.verify_credentials(skip_status=True)
self.assertFalse(hasattr(me, 'status'))
def testratelimitstatus(self):
self.api.rate_limit_status()
""" TODO(josh): Remove once this deprecated API is gone.
def testsetdeliverydevice(self):
self.api.set_delivery_device('im')
self.api.set_delivery_device('none')
"""
def testupdateprofilecolors(self):
original = self.api.me()
updated = self.api.update_profile_colors('000', '000', '000', '000', '000')
# restore colors
self.api.update_profile_colors(
original.profile_background_color,
original.profile_text_color,
示例4: TweepyAPITests
# 需要导入模块: from tweepy import API [as 别名]
# 或者: from tweepy.API import friends_ids [as 别名]
#.........这里部分代码省略.........
self.api.sent_direct_messages()
def testsendanddestroydirectmessage(self):
# send
sent_dm = self.api.send_direct_message(username, text="test message")
self.assertEqual(sent_dm.text, "test message")
self.assertEqual(sent_dm.sender.screen_name, username)
self.assertEqual(sent_dm.recipient.screen_name, username)
# destroy
destroyed_dm = self.api.destroy_direct_message(sent_dm.id)
self.assertEqual(destroyed_dm.text, sent_dm.text)
self.assertEqual(destroyed_dm.id, sent_dm.id)
self.assertEqual(destroyed_dm.sender.screen_name, username)
self.assertEqual(destroyed_dm.recipient.screen_name, username)
def testcreatedestroyfriendship(self):
enemy = self.api.destroy_friendship("twitter")
self.assertEqual(enemy.screen_name, "twitter")
# Wait 5 seconds to allow Twitter time
# to process the friendship destroy request.
sleep(5)
friend = self.api.create_friendship("twitter")
self.assertEqual(friend.screen_name, "twitter")
def testshowfriendship(self):
source, target = self.api.show_friendship(target_screen_name="twtiter")
self.assert_(isinstance(source, Friendship))
self.assert_(isinstance(target, Friendship))
def testfriendsids(self):
self.api.friends_ids(username)
def testfollowersids(self):
self.api.followers_ids(username)
def testfriends(self):
self.api.friends(username)
def testfollowers(self):
self.api.followers(username)
def testverifycredentials(self):
self.assertNotEqual(self.api.verify_credentials(), False)
# make sure that `me.status.entities` is not an empty dict
me = self.api.verify_credentials(include_entities=True)
self.assertTrue(me.status.entities)
# `status` shouldn't be included
me = self.api.verify_credentials(skip_status=True)
self.assertFalse(hasattr(me, "status"))
def testratelimitstatus(self):
self.api.rate_limit_status()
""" TODO(josh): Remove once this deprecated API is gone.
def testsetdeliverydevice(self):
self.api.set_delivery_device('im')
self.api.set_delivery_device('none')
"""
def testupdateprofilecolors(self):
original = self.api.me()