Dynamic callback url works again, PEP8 clean up #69

Merged
michaelhelmick merged 3 commits from master into master 2012-03-21 12:43:16 -07:00
2 changed files with 77 additions and 79 deletions

View file

@ -4,7 +4,7 @@ from setuptools import setup
from setuptools import find_packages from setuptools import find_packages
__author__ = 'Ryan McGrath <ryan@venodesigns.net>' __author__ = 'Ryan McGrath <ryan@venodesigns.net>'
__version__ = '1.5.0' __version__ = '1.5.1'
setup( setup(
# Basic package information. # Basic package information.

View file

@ -9,7 +9,7 @@
""" """
__author__ = "Ryan McGrath <ryan@venodesigns.net>" __author__ = "Ryan McGrath <ryan@venodesigns.net>"
__version__ = "1.5.0" __version__ = "1.5.1"
import urllib import urllib
import re import re
@ -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
@ -242,9 +243,6 @@ class Twython(object):
request_args['oauth_callback'] = callback_url request_args['oauth_callback'] = callback_url
method = 'get' method = 'get'
if not OAUTH_LIB_SUPPORTS_CALLBACK:
method = 'post'
func = getattr(self.client, method) func = getattr(self.client, method)
response = func(self.request_token_url, data=request_args) response = func(self.request_token_url, data=request_args)
@ -310,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):
@ -623,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):