There are many URL shortening services. I just picked one (u.nu) to use from command line interface and chose something really quick and simple. Here’s the code:
# -*- coding: utf-8 -*-
from urllib import urlencode
import httplib
import sys
api_url=”u.nu”
var = urlencode({‘url’:sys.argv[1]})
args = “/unu-api-simple?%s” % (var)
conn = httplib.HTTPConnection(api_url)
conn.request(“GET”,args)
ret = conn.getresponse()
print ret.read()
Download the script here.
Just run passing the URL, for example:
$ [...]