Fix for issue #25, certain search queries not being properly encoded. Thanks to momander for pointing this out...

This commit is contained in:
Ryan McGrath 2010-11-28 17:56:11 +09:00
parent 5f1d0d4e90
commit 931921be01
3 changed files with 5 additions and 5 deletions

View file

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

View file

@ -9,7 +9,7 @@
"""
__author__ = "Ryan McGrath <ryan@venodesigns.net>"
__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"):

View file

@ -9,7 +9,7 @@
"""
__author__ = "Ryan McGrath <ryan@venodesigns.net>"
__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"):