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


Python API.rate_limit_status方法代码示例

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


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

示例1: main

# 需要导入模块: from tweepy import API [as 别名]
# 或者: from tweepy.API import rate_limit_status [as 别名]
def main():
    # Set up the authentication!
    auth = OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
    auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
    api = API(auth)
    ratelimit = api.rate_limit_status()
    # Create a user and public stream
    u = UserStreamListener()
    userstream = Stream(auth, u)

    p = PublicStreamListener()
    publicstream = Stream(auth, p)

    # Show my followers
    f = Follow(auth)
    print f.my_followers()

    print "Streaming started..."
    publicstream.filter(track=TRACKING_TERMS)
开发者ID:fenrirvinclis,项目名称:ferret,代码行数:21,代码来源:ferret.py

示例2: TweepyAPITests

# 需要导入模块: from tweepy import API [as 别名]
# 或者: from tweepy.API import rate_limit_status [as 别名]

#.........这里部分代码省略.........
        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,
            original.profile_link_color,
            original.profile_sidebar_fill_color,
            original.profile_sidebar_border_color
        )

        self.assertEqual(updated.profile_background_color, '000')
        self.assertEqual(updated.profile_text_color, '000')
        self.assertEqual(updated.profile_link_color, '000')
        self.assertEqual(updated.profile_sidebar_fill_color, '000')
        self.assertEqual(updated.profile_sidebar_border_color, '000')

    """
    def testupateprofileimage(self):
        self.api.update_profile_image('examples/profile.png')

    def testupdateprofilebg(self):
        self.api.update_profile_background_image('examples/bg.png')
开发者ID:Kudo,项目名称:tweepy,代码行数:70,代码来源:tests.py

示例3: str

# 需要导入模块: from tweepy import API [as 别名]
# 或者: from tweepy.API import rate_limit_status [as 别名]
	graph.create(a)
	graph.create(b)
	
	c = graph.find_one("regular", "screen_name", "a")
	print c
	
	counter = 0;
	
	temp = api.get_user("Newsweek");
	print temp.followers_count
	print temp.friends_count
	print temp.screen_name
	"""
	counter = 0;
	while True:
		status = api.rate_limit_status()
		resources = status['resources']
		followers = resources['followers']
		f_list = followers['/followers/list']
		remaining = f_list['remaining']
		
		print remaining
		
		if remaining == 0:
			print "Sleeping... ";
			print "minutes passed: " + str(counter);
			counter += 1;
			time.sleep(60)
		else:
			print "Reset..."
			break;
开发者ID:benwalcutt,项目名称:big_data_project,代码行数:33,代码来源:check.py

示例4: TweepyAPITests

# 需要导入模块: from tweepy import API [as 别名]
# 或者: from tweepy.API import rate_limit_status [as 别名]

#.........这里部分代码省略.........

        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()
        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,
            original.profile_link_color,
            original.profile_sidebar_fill_color,
            original.profile_sidebar_border_color,
        )

        self.assertEqual(updated.profile_background_color, "000000")
        self.assertEqual(updated.profile_text_color, "000000")
        self.assertEqual(updated.profile_link_color, "000000")
        self.assertEqual(updated.profile_sidebar_fill_color, "000000")
        self.assertEqual(updated.profile_sidebar_border_color, "000000")

    """
    def testupateprofileimage(self):
        self.api.update_profile_image('examples/profile.png')

    def testupdateprofilebg(self):
        self.api.update_profile_background_image('examples/bg.png')
开发者ID:QiaozhiWang,项目名称:tweepy,代码行数:70,代码来源:tests.py


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