passman.add_password(None, baseurl, user, password)
auth_NTLM = HTTPNtlmAuthHandler.HTTPNtlmAuthHandler(passman)
browser = mechanize.Browser()
browser.add_handler(auth_NTLM)
handlersToKeep = []
for handler in browser.handlers:
    if not isinstance(handler, (mechanize._auth.ProxyHandler, mechanize.
        _urllib2_support.HTTPRobotRulesProcessor)):
        handlersToKeep.append(handler)
browser.handlers = handlersToKeep
browser.open(url)
Пользовательский обработчик авторизации с механизацией