python obtém cabeçalhos apenas usando urllib2

Preciso implementar uma função para obter apenas cabeçalhos (sem fazer um GET ou POST) usando urllib2. Aqui está a minha função:

def getheadersonly(url, redirections = True):
    if not redirections:
        class MyHTTPRedirectHandler(urllib2.HTTPRedirectHandler):
            def http_error_302(self, req, fp, code, msg, headers):
                return urllib2.HTTPRedirectHandler.http_error_302(self, req, fp, code, msg, headers)
            http_error_301 = http_error_303 = http_error_307 = http_error_302
        cookieprocessor = urllib2.HTTPCookieProcessor()
        opener = urllib2.build_opener(MyHTTPRedirectHandler, cookieprocessor)
        urllib2.install_opener(opener)

    class HeadRequest(urllib2.Request):
        def get_method(self):
            return "HEAD"

    info = {}
    info['headers'] = dict(urllib2.urlopen(HeadRequest(url)).info()) 
    info['finalurl'] = urllib2.urlopen(HeadRequest(url)).geturl() 
    return info

Utiliza o código da respostaest eest. No entanto, esteestá fazend redirecionamento mesmo quando o sinalizador éFalse. Eu tentei o código com:

print getheadersonly("http://ms.com", redirections = False)['finalurl']
print getheadersonly("http://ms.com")['finalurl']

Dá morganstanley.com nos dois casos. O que há de errado aqui?

questionAnswers(4)

yourAnswerToTheQuestion