tweepy/tweepy — pull request #256 by inactivist (2013-02-16 18:26:21+00:00)
Title: Initial implementation for issue #254: add rate limit info to API object.

Here's my initial implementation. It exposes two new properties on the `tweepy.api.API` object:
* `last_headers`: A dict containing the last response headers received.
* `api_limits`: A `tweepy.api.RateLimitInfo` object.

The `tweepy.api.RateLimitInfo` object exposes the following fields and methods:
* `reset` - the int value of the `x-rate-limit-reset` header value
* `limit` - the int value of the `x-rate-limit-limit` header value
* `remaining` - the int value of the `x-rate-limit-remaining` header value
* `seconds_till_reset(current_time=None)` - the number of seconds remaining until the next API limit reset, using the current time (`time.time()`) if `current_time` == `None`, or, based on the timestamp passed as the value of `current_time`.

Note: The default values for `RateLimitInfo` `reset`, `limit`, and `remaining` are set to 0 (zero) if any of the expected header values are not present.

See: [REST API Rate Limiting in v1.1](https://dev.twitter.com/docs/rate-limiting/1.1)