Huh, that indentation was off... backing out this comment for now
This commit is contained in:
parent
f2101405e9
commit
983f8e3065
1 changed files with 0 additions and 14 deletions
|
|
@ -90,20 +90,6 @@ class setup:
|
||||||
|
|
||||||
# URL Shortening function huzzah
|
# URL Shortening function huzzah
|
||||||
def shortenURL(self, url_to_shorten, shortener = "http://is.gd/api.php", query = "longurl"):
|
def shortenURL(self, url_to_shorten, shortener = "http://is.gd/api.php", query = "longurl"):
|
||||||
"""
|
|
||||||
function:: shortenURL(url_to_shorten, shortener, query)
|
|
||||||
|
|
||||||
Returns a shortened URL.
|
|
||||||
|
|
||||||
:param url_to_shorten: URL to shorten, as a String
|
|
||||||
:param shortener: URL to an API call for a different shortening service, allows overriding.
|
|
||||||
:param query: Name of the param that you pass the long URL as.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
>>> twitter = tango.setup()
|
|
||||||
>>> twitter.shortenURL("http://webs.com/")
|
|
||||||
|
|
||||||
"""
|
|
||||||
try:
|
try:
|
||||||
return urllib2.urlopen(shortener + "?" + urllib.urlencode({query: url_to_shorten})).read()
|
return urllib2.urlopen(shortener + "?" + urllib.urlencode({query: url_to_shorten})).read()
|
||||||
except HTTPError, e:
|
except HTTPError, e:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue