diff --git a/resources/lib/tinyurl.py b/resources/lib/tinyurl.py new file mode 100644 index 0000000..35e6c92 --- /dev/null +++ b/resources/lib/tinyurl.py @@ -0,0 +1,11 @@ +import urllib2 + +#this is duplicated in snipppets of code from all over the web, credit to no one +#in particular - to all those that have gone before me! +def shorten(aUrl): + tinyurl = 'http://tinyurl.com/api-create.php?url=' + req = urllib2.urlopen(tinyurl + aUrl) + data = req.read() + + #should be a tiny url + return str(data)