From 5a516c2bfbbea3a1474bde98dc466d152eca8143 Mon Sep 17 00:00:00 2001 From: Mike Helmick Date: Wed, 10 Oct 2012 12:55:35 -0400 Subject: [PATCH 1/3] Version bump --- setup.py | 2 +- twython/twython.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 0e1adb7..ca03758 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup from setuptools import find_packages __author__ = 'Ryan McGrath ' -__version__ = '2.4.0' +__version__ = '2.5.0' setup( # Basic package information. diff --git a/twython/twython.py b/twython/twython.py index 3fa2b5d..d8c50b9 100644 --- a/twython/twython.py +++ b/twython/twython.py @@ -9,7 +9,7 @@ """ __author__ = "Ryan McGrath " -__version__ = "2.4.0" +__version__ = "2.5.0" import urllib import re From 4e86da4aec63acb581d02eb3046ae1a098485356 Mon Sep 17 00:00:00 2001 From: Mike Helmick Date: Mon, 29 Oct 2012 12:36:45 -0400 Subject: [PATCH 2/3] Posts with files and params works with requests 0.14.0 #122 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ca03758..c9177e3 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( include_package_data=True, # Package dependencies. - install_requires=['simplejson', 'requests>=0.13.9'], + install_requires=['simplejson', 'requests>=0.14.0'], # Metadata for PyPI. author='Ryan McGrath', From 98e213df9c8f6c46ca4dda6093a98bc958086caa Mon Sep 17 00:00:00 2001 From: Mike Helmick Date: Mon, 29 Oct 2012 12:37:16 -0400 Subject: [PATCH 3/3] Fixes #121 --- twython/twython.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/twython/twython.py b/twython/twython.py index d8c50b9..9ba5370 100644 --- a/twython/twython.py +++ b/twython/twython.py @@ -165,6 +165,11 @@ class Twython(object): raise TwythonError('Method must be of GET or POST') params = params or {} + # requests doesn't like items that can't be converted to unicode, + # so let's be nice and do that for the user + for k, v in params.items(): + if isinstance(v, (int, bool)): + params[k] = u'%s' % v func = getattr(self.client, method) if method == 'get': @@ -185,15 +190,14 @@ class Twython(object): 'content': content, } - # wrap the json loads in a try, and defer an error # why? twitter will return invalid json with an error code in the headers json_error = False try: content = simplejson.loads(content) except ValueError: - json_error= True - content= {} + json_error = True + content = {} if response.status_code > 304: # If there is no error message, use a default.