Getting final url when original url redirects

IanR IanReardon at
Thu Mar 12 20:57:03 CET 2009

I'm processing RSS content from a # of given sources.  Most of the
time the url given by the RSS feed redirects to the real URL (I'm
guessing they do this for tracking purposes)

For example.

This is a url that I get from and RSS feed,
It redirects to

I want to record the final URL and not the URL I get from the RSS feed
(However sometimes there is no redirect so I might want the original

I've tried sniffing the header and don't see any "Location:"... I
think sites are using different ways to redirect.  Does anyone have
any suggestions on how I might handle this?

More information about the Python-list mailing list