Fix errors due to Requests merge.
authorJoshua Roesslein <jroesslein@opengov.com>
Sun, 27 Apr 2014 05:00:08 +0000 (22:00 -0700)
committerJoshua Roesslein <jroesslein@opengov.com>
Sun, 27 Apr 2014 05:00:08 +0000 (22:00 -0700)
tweepy/auth.py
tweepy/binder.py

index 439a6900e52c73109d294b062d2ae8696161742b..b3041397d1865ae263adb920ba1d109ee6b97dcb 100644 (file)
@@ -1,10 +1,8 @@
-#Embedded file name: /home/aaron/repos/tweepy/tweepy/auth.py
 from urllib2 import Request, urlopen
 import urllib
 import base64
 import json
 
-from tweepy import oauth
 from tweepy.error import TweepError
 from tweepy.api import API
 import requests
index 68074fa554dd153d9a0dc827f9eb36bce7e90be3..a15c49251500faa4794b6e9c186bc3788bff6352 100644 (file)
@@ -162,12 +162,12 @@ def bind_api(**config):
                             auth=auth)
                 except Exception, e:
                     raise TweepError('Failed to send request: %s' % e)
-                rem_calls = resp.getheader('x-rate-limit-remaining')
+                rem_calls = resp.headers.get('x-rate-limit-remaining')
                 if rem_calls is not None:
                     self._remaining_calls = int(rem_calls)
                 elif isinstance(self._remaining_calls, int):
                     self._remaining_calls -= 1
-                reset_time = resp.getheader('x-rate-limit-reset')
+                reset_time = resp.headers.get('x-rate-limit-reset')
                 if reset_time is not None:
                     self._reset_time = int(reset_time)
                 if self.wait_on_rate_limit and self._remaining_calls == 0 and (resp.status == 429 or resp.status == 420): # if ran out of calls before waiting switching retry last call