Fix a shortenURL reference bug pointed out by Jacob, incremental release of latest bugfixes because Pypi's been down recently
This commit is contained in:
parent
ace1a87745
commit
8ecdaa5bfa
3 changed files with 70 additions and 76 deletions
2
setup.py
2
setup.py
|
|
@ -5,7 +5,7 @@ from setuptools import setup
|
|||
from setuptools import find_packages
|
||||
|
||||
__author__ = 'Ryan McGrath <ryan@venodesigns.net>'
|
||||
__version__ = '1.3.5'
|
||||
__version__ = '1.3.6'
|
||||
|
||||
setup(
|
||||
# Basic package information.
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
"""
|
||||
|
||||
__author__ = "Ryan McGrath <ryan@venodesigns.net>"
|
||||
__version__ = "1.3.5"
|
||||
__version__ = "1.3.6"
|
||||
|
||||
import urllib
|
||||
import urllib2
|
||||
|
|
@ -223,10 +223,7 @@ class Twython(object):
|
|||
shortener - In case you want to use a url shortening service other than is.gd.
|
||||
"""
|
||||
try:
|
||||
resp, content = self.client.request(
|
||||
shortener + "?" + urllib.urlencode({query: Twython.unicode2utf8(url_to_shorten)}),
|
||||
"GET"
|
||||
)
|
||||
content = urllib2.urlopen(shortener + "?" + urllib.urlencode({query: Twython.unicode2utf8(url_to_shorten)})).read()
|
||||
return content
|
||||
except HTTPError, e:
|
||||
raise TwythonError("shortenURL() failed with a %s error code." % `e.code`)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
"""
|
||||
|
||||
__author__ = "Ryan McGrath <ryan@venodesigns.net>"
|
||||
__version__ = "1.3.5"
|
||||
__version__ = "1.3.6"
|
||||
|
||||
import urllib.request, urllib.parse, urllib.error
|
||||
import urllib.request, urllib.error, urllib.parse
|
||||
|
|
@ -166,7 +166,7 @@ class Twython(object):
|
|||
|
||||
# Then open and load that shiiit, yo. TODO: check HTTP method and junk, handle errors/authentication
|
||||
if fn['method'] == 'POST':
|
||||
resp, content = self.client.request(base, fn['method'], urllib.parse.urlencode(kwargs))
|
||||
resp, content = self.client.request(base, fn['method'], urllib.parse.urlencode(dict([k, v.encode('utf-8')] for k, v in list(kwargs.items()))))
|
||||
else:
|
||||
url = base + "?" + "&".join(["%s=%s" %(key, value) for (key, value) in kwargs.items()])
|
||||
resp, content = self.client.request(url, fn['method'])
|
||||
|
|
@ -223,10 +223,7 @@ class Twython(object):
|
|||
shortener - In case you want to use a url shortening service other than is.gd.
|
||||
"""
|
||||
try:
|
||||
resp, content = self.client.request(
|
||||
shortener + "?" + urllib.parse.urlencode({query: Twython.unicode2utf8(url_to_shorten)}),
|
||||
"GET"
|
||||
)
|
||||
content = urllib.request.urlopen(shortener + "?" + urllib.parse.urlencode({query: Twython.unicode2utf8(url_to_shorten)})).read()
|
||||
return content
|
||||
except HTTPError as e:
|
||||
raise TwythonError("shortenURL() failed with a %s error code." % repr(e.code))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue