Controlling IE 5.x from Python: HTTP Status Codes

Dave Swindell davids at simutility.com
Thu Sep 19 21:40:28 CEST 2002


I'm trying to control IE 5.5 from Python and ham having some problems.
Using PythonWin with Mark Hammond's COM interface extensions, I've
been able to launch IE and navigate to a specified website using the
following code:

from win32com.client import constants, Dispatch, DispatchWithEvents

ie=Dispatch("InternetExplorer.Application)
ie.Visible=1
ie.Navigate("http://www.python.org",2)

This all works fine, except that I'd like to know the HTTP Status Code
that resulted from the Navigate automation interface in IE. Using the
DispatchWithEvents call, I've been able to trap OnDocumentComplete and
OnNavigate2Complete events, but these don't appear to provide you with
access to the HTTP status codes resulting from the Navigate call.

IE 6.0 has a NavigateError event which, according to the
documentation, will allow you to access the HTTP status code, but the
project I'm working on needs to use IE 5.0/5.5.

Anyone else run into this issue or even better, found a way around it?

Thanks,

    -- Dave Swindell
       davids at simutility.com



More information about the Python-list mailing list