From 931921be0195e8be4085838b1eedd69be6245a06 Mon Sep 17 00:00:00 2001 From: Ryan McGrath Date: Sun, 28 Nov 2010 17:56:11 +0900 Subject: [PATCH] Fix for issue #25, certain search queries not being properly encoded. Thanks to momander for pointing this out... --- setup.py | 2 +- twython/twython.py | 4 ++-- twython3k/twython.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 69f1726..ff542a4 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ from setuptools import setup from setuptools import find_packages __author__ = 'Ryan McGrath ' -__version__ = '1.3.4' +__version__ = '1.3.5' setup( # Basic package information. diff --git a/twython/twython.py b/twython/twython.py index d1822ce..e5a3b3f 100644 --- a/twython/twython.py +++ b/twython/twython.py @@ -9,7 +9,7 @@ """ __author__ = "Ryan McGrath " -__version__ = "1.3.4" +__version__ = "1.3.5" import urllib import urllib2 @@ -210,7 +210,7 @@ class Twython(object): @staticmethod def constructApiURL(base_url, params): - return base_url + "?" + "&".join(["%s=%s" %(Twython.unicode2utf8(key), Twython.unicode2utf8(value)) for (key, value) in params.iteritems()]) + return base_url + "?" + "&".join(["%s=%s" %(Twython.unicode2utf8(key), urllib.quote_plus(Twython.unicode2utf8(value))) for (key, value) in params.iteritems()]) @staticmethod def shortenURL(url_to_shorten, shortener = "http://is.gd/api.php", query = "longurl"): diff --git a/twython3k/twython.py b/twython3k/twython.py index ee3f7ad..406dbc6 100644 --- a/twython3k/twython.py +++ b/twython3k/twython.py @@ -9,7 +9,7 @@ """ __author__ = "Ryan McGrath " -__version__ = "1.3.4" +__version__ = "1.3.5" import urllib.request, urllib.parse, urllib.error import urllib.request, urllib.error, urllib.parse @@ -210,7 +210,7 @@ class Twython(object): @staticmethod def constructApiURL(base_url, params): - return base_url + "?" + "&".join(["%s=%s" %(Twython.unicode2utf8(key), Twython.unicode2utf8(value)) for (key, value) in params.items()]) + return base_url + "?" + "&".join(["%s=%s" %(Twython.unicode2utf8(key), urllib.parse.quote_plus(Twython.unicode2utf8(value))) for (key, value) in params.items()]) @staticmethod def shortenURL(url_to_shorten, shortener = "http://is.gd/api.php", query = "longurl"):