I am just learning python and is interested in how this can be accomplished. During the search for the answer, I came across this service: http://www.longurlplease.com
For example:
http://bit.ly/rgCbf can be converted to:
http://webdesignledger.com/freebies/the-best-social-media-icons-all-in-one-place
I did some inspecting with Firefox and see that the original url is not in the header.
Enter
urllib2, which offers the easiest way of doing this:For reference’s sake, however, note that this is also possible with
httplib:And with
PycURL, although I’m not sure if this is the best way to do it using it: