OWA (Outlook Web Access) with urllib2

John J. Lee jjl at pobox.com
Mon Sep 27 17:41:09 EDT 2004


pascal.parent at free.fr (Pascal) writes:

> This is the Python ~ IIS dialogue (with Ethereal / Follow TCP stream):
> 
> GET /exchange/ HTTP/1.0
> Host: owa.mydomain
> User-agent: Python-urllib/2.1
> 
> HTTP/1.1 401 Accès refusé
> Server: Microsoft-IIS/5.0
> Date: Mon, 27 Sep 2004 10:44:28 GMT
> WWW-Authenticate: Negotiate
> WWW-Authenticate: NTLM
> WWW-Authenticate: Basic realm="owa.mydomain"
> Content-Length: 21
> Content-Type: text/html
> 
> Urllib2 didn't try to send authentification after http 401 error.

Well, there's your problem <0.5 wink>.

Seriously:

1. Test your code with Python 2.4a3.  Quite possible that this is a
   fixed bug.

2. If that doesn't work, debug urllib2.
   HTTPPasswordMgr.find_user_password() looks a good place to stick
   some print statements.  Also, the method of
   AbstractBasicAuthHandler.  It's only a few lines of code!


John



More information about the Python-list mailing list