Permalink
Browse files

Fix mistake in api.wrap_response, before this fix, we can't access to…

… "rate_limit_remaining" and "rate_limit_reset" properties in "WrappedTwitterResponse" class
  • Loading branch information...
1 parent 5064d2a commit c77b5e4b337a8cb031ae860d90e668f28fdec7d0 Stephane Klein committed Oct 30, 2011
Showing with 9 additions and 2 deletions.
  1. +4 −1 tests/test_sanity.py
  2. +5 −1 twitter/api.py
@@ -1,6 +1,7 @@
# encoding: utf8
from random import choice
+import time
from twitter import Twitter, NoAuth, OAuth, read_token_file
from twitter.cmdline import CONSUMER_KEY, CONSUMER_SECRET
@@ -30,9 +31,11 @@ def test_API_get_some_public_tweets():
def test_API_set_tweet():
random_tweet = "A random tweet " + get_random_str()
twitter.statuses.update(status=random_tweet)
-
+ time.sleep(2)
recent = twitter.statuses.user_timeline()
assert recent
+ assert isinstance(recent.rate_limit_remaining, int)
+ assert isinstance(recent.rate_limit_reset, int)
assert random_tweet == recent[0]['text']
View
@@ -79,7 +79,11 @@ def wrap_response(response, headers):
class WrappedTwitterResponse(response_typ, TwitterResponse):
__doc__ = TwitterResponse.__doc__
- return WrappedTwitterResponse(response)
+ def __init__(self, response, headers):
+ response_typ.__init__(self, response)
+ TwitterResponse.__init__(self, headers)
+
+ return WrappedTwitterResponse(response, headers)

0 comments on commit c77b5e4

Please sign in to comment.