Я хочу извлечь некоторые данные с веб-страницы, для которой требуются имя пользователя и пароль для Windows.
До сих пор у меня было:
opener = build_opener()
try:
    page = opener.open("http://somepagewhichneedsmywindowsusernameandpassword/")
    print page
except URLError:
    print "Oh noes."
Поддерживается ли это urllib2? Я нашел Python NTLM, но для этого требуется, чтобы я ввел свое имя пользователя и пароль. Есть ли способ как-то просто получить информацию об аутентификации ( например, IE или Firefox, если я изменил настройки network.automatic-ntlm-auth.trusted-uris).
Изменить после ответа msander
Итак, я получил следующее:
# Send a simple "message" over a socket - send the number of bytes first,
# then the string.  Ditto for receive.
def _send_msg(s, m):
    s.send(struct.pack("i", len(m)))
    s.send(m)
def _get_msg(s):
    size_data = s.recv(struct.calcsize("i"))
    if not size_data:
        return None
    cb = struct.unpack("i", size_data)[0]
    return s.recv(cb)
def sspi_client():
    c = httplib.HTTPConnection("myserver")
    c.connect()
    # Do the auth dance.
    ca = sspi.ClientAuth("NTLM", win32api.GetUserName())
    data = None
    while 1:
        err, out_buf = ca.authorize(data) # error 400 triggered by this line
        _send_msg(c.sock, out_buf[0].Buffer)
        if err==0:
            break
        data = _get_msg(c.sock)
    print "Auth dance complete - sending a few encryted messages"
    # Assume out data is sensitive - encrypt the message.
    for data in "Hello from the client".split():
        blob, key = ca.encrypt(data)
        _send_msg(c.sock, blob)
        _send_msg(c.sock, key)
    c.sock.close()
    print "Client completed."
 который довольно хорошо разорван из socket_server.py (см. здесь). Но я получаю ошибку 400 - плохой запрос. У кого-нибудь есть какие-то дальнейшие идеи?
Спасибо,
Дом
