python twitter库速率限制检查

时间:2015-05-20 03:36:51

标签: python api python-2.7 twitter

我试图通过使用rate_limit_remaining调用找出剩余的速率限制,但它似乎没有正常工作。根据pydoc:

class TwitterResponse(__builtin__.object)
 |  Response from a twitter request. Behaves like a list or a string
 |  (depending on requested format) but it has a few other interesting
 |  attributes.
 |  
 |  `headers` gives you access to the response headers as an
 |  httplib.HTTPHeaders instance. You can do
 |  `response.headers.get('h')` to retrieve a header.
 |  
 |  Data descriptors defined here:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)
 |  
 |  rate_limit_limit
 |      The rate limit ceiling for that given request.
 |  
 |  rate_limit_remaining
 |      Remaining requests in the current rate-limit.
 |  
 |  rate_limit_reset
 |      Time in UTC epoch seconds when the rate limit will reset.

我的代码:

from twitter import *
t = Twitter(
    auth=OAuth('all the tokens'))

t.TwitterResponse.rate_limit_remaining

0 个答案:

没有答案