Dynamic callback url works again, PEP8 clean up #69
1 changed files with 75 additions and 74 deletions
|
|
@ -95,6 +95,7 @@ class TwythonAPILimit(TwythonError):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return repr(self.msg)
|
return repr(self.msg)
|
||||||
|
|
||||||
|
|
||||||
class APILimit(TwythonError):
|
class APILimit(TwythonError):
|
||||||
"""
|
"""
|
||||||
Raised when you've hit an API limit. Try to avoid these, read the API
|
Raised when you've hit an API limit. Try to avoid these, read the API
|
||||||
|
|
@ -307,10 +308,10 @@ class Twython(object):
|
||||||
'query': url_to_shorten
|
'query': url_to_shorten
|
||||||
})
|
})
|
||||||
|
|
||||||
if r.status_code in [301, 201, 200]:
|
if request.status_code in [301, 201, 200]:
|
||||||
return request.text
|
return request.text
|
||||||
else:
|
else:
|
||||||
raise TwythonError('shortenURL() failed with a %s error code.' % r.status_code)
|
raise TwythonError('shortenURL() failed with a %s error code.' % request.status_code)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def constructApiURL(base_url, params):
|
def constructApiURL(base_url, params):
|
||||||
|
|
@ -620,7 +621,7 @@ class Twython(object):
|
||||||
|
|
||||||
for line in stream.iter_lines():
|
for line in stream.iter_lines():
|
||||||
if line:
|
if line:
|
||||||
callback(json.loads(line))
|
callback(simplejson.loads(line))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def unicode2utf8(text):
|
def unicode2utf8(text):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue