How to check redirected web page address, without downloading it in Python
问题 For a given url, how can I detect final internet location after HTTP redirects, without downloading final page (e.g. HEAD request.) using python. I am trying to write a mass downloader, my downloading mechanism needs to know internet location of page before downloading it. edit I ended up doing this, I hope this helps other people. I am still open to other methods. import urlparse import httplib def getFinalUrl(url): "Navigates Through redirections to get final url." parsed = urlparse